zjin-lcf wrote: Thanks @wenju-he — you are right, the libclc change alone is not sufficient. I have added the 64-bit atomic extensions to `setSupportedOpenCLOpts()` in `clang/lib/Basic/Targets/NVPTX.h`.
For what it is worth, intel/llvm has carried exactly this downstream for a long time, with a comment giving the same rationale: ```c++ // PTX actually supports 64 bits operations even if the Nvidia OpenCL // runtime does not report support for it. // This is required for libclc to compile 64 bits atomic functions. // FIXME: maybe we should have a way to control this ? Opts["cl_khr_int64_base_atomics"] = true; Opts["cl_khr_int64_extended_atomics"] = true; ``` I guarded it on `getMaxAtomicInlineWidth() >= 64` rather than enabling it unconditionally. `NVPTXTargetInfo` sets `MaxAtomicInlineWidth` to the target pointer width, so this enables the extensions for `nvptx64` while leaving the 32-bit `nvptx` target unchanged — on that target 64-bit atomics would be emulated and would emit the "large atomic operation may incur significant performance penalty" warning that the original libclc guard was added to avoid. Happy to switch to the unconditional form to match intel/llvm if you would prefer that. https://github.com/llvm/llvm-project/pull/213691 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
