Remove wrapper flags when clang called from intel
This commit is contained in:
		
							parent
							
								
									f53d4aab54
								
							
						
					
					
						commit
						a3a0dbcc55
					
				| @ -147,6 +147,10 @@ stdenvNoCC.mkDerivation (finalAttrs: { | ||||
|         ln -s $out/bin/icpx $out/bin/c++ | ||||
|         ln -s $out/bin/icx  $out/bin/cc | ||||
| 
 | ||||
|         # Use this to detect when a compiler subprocess is called | ||||
|         # from icpx (--fsycl-host-compiler) | ||||
|         echo 'export "NIX_CC_WRAPPER_INTEL=1"' >> $out/nix-support/cc-wrapper-hook | ||||
| 
 | ||||
|         sed -i 's/.*isCxx=0/isCxx=1/' $out/bin/icpx | ||||
| 
 | ||||
|         # oneMath looks for sycl libraries in bin/../lib | ||||
|  | ||||
| @ -3,6 +3,7 @@ | ||||
| , lib | ||||
| , gcc | ||||
| , clangOmpss2Unwrapped | ||||
| , writeShellScript | ||||
| , openmp ? null | ||||
| , wrapCCWith | ||||
| , llvmPackages_latest | ||||
| @ -37,6 +38,19 @@ let | ||||
|   inherit gcc; | ||||
|   cc = clangOmpss2Unwrapped; | ||||
|   gccVersion = with versions; let v = gcc.version; in concatStringsSep "." [(major v) (minor v) (patch v)]; | ||||
| 
 | ||||
|   resetIntelCCFlags = let tconf = builtins.replaceStrings ["-"] ["_"] targetConfig; | ||||
|   in writeShellScript "remove-intel.sh" '' | ||||
|     if [ "''${NIX_CC_WRAPPER_INTEL:-0}" = 1 ]; then | ||||
|       unset NIX_CFLAGS_COMPILE_${tconf} | ||||
|       unset NIX_CC_WRAPPER_FLAGS_SET_${tconf} | ||||
| 
 | ||||
|       if (( "${NIX_DEBUG:-0}" >= 1 )); then | ||||
|         echo "ompss2: cleaned NIX_CFLAGS_COMPILE_${tconf} (invokation from intel compiler detected)" | ||||
|       fi | ||||
|     fi | ||||
|   ''; | ||||
| 
 | ||||
| in wrapCCWith { | ||||
|   inherit cc bintools; | ||||
|   # extraPackages adds packages to depsTargetTargetPropagated | ||||
| @ -58,7 +72,10 @@ in wrapCCWith { | ||||
| 
 | ||||
|     wrap clang++  $wrapper $ccPath/clang++ | ||||
| 
 | ||||
|   '' + optionalString (openmp != null) '' | ||||
|     sed -i 's|# Flirting.*|source ${resetIntelCCFlags}\n\n&|' $out/bin/clang | ||||
|     sed -i 's|# Flirting.*|&\nsource ${resetIntelCCFlags}\n\n&|' $out/bin/clang++ | ||||
| 
 | ||||
|   '' + lib.optionalString (openmp != null) '' | ||||
|     echo "export OPENMP_RUNTIME=${ompname}" >> $out/nix-support/cc-wrapper-hook | ||||
|   '' + optionalString (ompss2rt != null) '' | ||||
|     echo "export OMPSS2_RUNTIME=${rtname}" >> $out/nix-support/cc-wrapper-hook | ||||
|  | ||||
		Reference in New Issue
	
	Block a user