Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable OpenCL on macOS #133

Merged
merged 1 commit into from
Mar 2, 2025
Merged

Enable OpenCL on macOS #133

merged 1 commit into from
Mar 2, 2025

Conversation

wuyakuma
Copy link
Contributor

@wuyakuma wuyakuma commented Mar 1, 2025

Although OpenCL was marked as deprecated in macOS 10.14, it still seems to work very well.
With some minor changes, OpenCL traversal on macOS can now function, and the performance is fantastic (see the screenshot).

The results were verified by ValidateTraceResult() and also dumped to images.

PS: rayData.hit was not cleaned between ValidateTraceResult() calls. After adding some code to clean the data, I found that gpu4way is broken in the release build. However, this seems to be caused by BVH building not the traversal. When replacing bvh4_gpu->bvh4Data with the debug version, everything works fine. Maybe another macOS release compiler mystery?

GPU Traversal

@jbikker
Copy link
Owner

jbikker commented Mar 2, 2025

Very impressive work! I can't change it obviously, but I am grateful for this PR.

@jbikker jbikker merged commit aca863f into jbikker:dev Mar 2, 2025
6 checks passed
@jbikker
Copy link
Owner

jbikker commented Mar 2, 2025

Wait a minute @wuyakuma does that screenshot say 16B rays per second? That is insane. :)

@wuyakuma
Copy link
Contributor Author

wuyakuma commented Mar 3, 2025

Wait a minute @wuyakuma does that screenshot say 16B rays per second? That is insane. :)

Yeah, that's about 10x faster than my Windows machine. Totally unexpected. If I hadn't seen the verification myself, I still wouldn't believe it.

@wuyakuma
Copy link
Contributor Author

wuyakuma commented Mar 3, 2025

I still have concerns about the results due to the significant performance difference. It would be great if someone could verify it on macOS too.
If anyone interested, here are my local changes to tiny_bvh_speedtest.cpp, which include cleaning raydata between each test and dumping the results to an image (stb_image_write is required).
tiny_bvh_speedtest.cpp.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants