Add a DoNotOptimize that works in device code
Nobody has claimed this yet.
- Dominant language
- Cuda
- Stars
- 927
- Forks
- 123
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 2
Description
It would be nice to have a utility similar to Google Benchmarks "DoNotOptimize" that attempts to prevent compiler optimizations from discarding results.
GBench's version uses inline assembly tricks that won't work with PTX because even if the generated PTX avoids the optimizer, OCG and SASS generation will almost certainly undo any attempt made to avoid optimization. We'll have to be a little trickier with the device equivalent.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the linked Google Benchmark DoNotOptimize implementation and compare its inline assembly approach with the device-code constraints described for PTX, OCG, and SASS. Define a device-code utility whose results are not discarded by compiler or later code generation, then verify that the behavior holds through the device compilation pipeline.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100