================
@@ -37,6 +37,16 @@ AMDGPUOpenMPToolChain::AMDGPUOpenMPToolChain(const Driver &D,
   // Lookup binaries into the driver directory, this is used to
   // discover the 'amdgpu-arch' executable.
   getProgramPaths().push_back(getDriver().Dir);
+  // Diagnose unsupported sanitizer options only once.
+  if (!Args.hasFlag(options::OPT_fgpu_sanitize, options::OPT_fno_gpu_sanitize,
----------------
ampandey-1995 wrote:

Yes. We actually had a flag ```**-fgpu-sanitize**```  from the beginning of 
ASan project which actually used by every toolchain(hip,openmp,opencl) to 
enable device code instrumentation.

Using ```**-fsanitize=address**```  enables asan instrumentation for host code 
, now for device when ```**-fgpu-sanitize**[Default always on]``` can be used 
alongwith ```**-fsanitize=address**``` but since it value is by default on so 
using ```-fgpu-sanitize``` only(without -fsanitize=address) would be  a no-op 
effect for both host and device code.

We only use the negative ```-fno-gpu-sanitize``` to disable device code asan 
instrumentation leaving only the host code asan instrumented.

BTW,  other checks are also done in progression i.e in  
```shouldSkipSanitizeFunction``` which checks for ```:xnack+```  feature also 
in ```--offload-arch=``` option.
 
In short asan instrumentation for both host and device is done using 
```-fsanitize=address```  , there are inbuilt clang-driver checks for 
hip,openmp,opencl which if successful allows -fsanitize=address to pass forward 
to device toolchain cmd line job invocation otherwise it is skipped.

If any  edge tests cases missing please let me know @b-sumner  , @yxsamliu , 
@jhuber6 ?


https://github.com/llvm/llvm-project/pull/124754
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to