Skip to content

[perf] scope slen to loop body to keep HIP photon loop flat - #267

Open
PrasoonMishra wants to merge 1 commit into
fangq:masterfrom
PrasoonMishra:perf/slen-loop-scope
Open

[perf] scope slen to loop body to keep HIP photon loop flat#267
PrasoonMishra wants to merge 1 commit into
fangq:masterfrom
PrasoonMishra:perf/slen-loop-scope

Conversation

@PrasoonMishra

@PrasoonMishra PrasoonMishra commented Aug 3, 2026

Copy link
Copy Markdown

Declaring slen inside the loop body (instead of at function scope), just like it is in the OpenCL code, makes the port exactly the same. This is a very small change that should not have mattered, but it leads to optimization changes and degradation. We are looking into how to prevent such small things from hampering perf so drastically, but in the meantime, this can be merged as it brings the HIP port to parity with the OpenCL port.

Declaring `slen` inside the loop body (instead of at function scope),
just like it is in the OpenCL code, makes the port exactly the same.
This is a very small change that should not have mattered, but it leads
to a lot of optimization changes and degradation.  We are looking into
how to prevent such small things from hampering perf so drastically,
but in the meantime this can be merged as it brings the HIP port to
parity with the OpenCL port.
@PrasoonMishra

Copy link
Copy Markdown
Author

Sample result:
./bin/mcx --bench cube60 -n 1e8 on MI250X (gfx90a):

  • before: ~10.7k photon/ms, absorbed 17.69708%
  • after: ~55.4k photon/ms, absorbed 17.69708%

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.

1 participant