Merge pull request #258328 from Madouura/pr/rocm-update

authored by

Bernardo Meurer and committed by
GitHub
fd1b8146 429d5f41

+3276 -8060
+3 -3
nixos/doc/manual/configuration/gpu-accel.chapter.md
··· 26 26 27 27 ```ShellSession 28 28 $ export \ 29 - OCL_ICD_VENDORS=`nix-build '<nixpkgs>' --no-out-link -A rocm-opencl-icd`/etc/OpenCL/vendors/ 29 + OCL_ICD_VENDORS=`nix-build '<nixpkgs>' --no-out-link -A rocmPackages.clr.icd`/etc/OpenCL/vendors/ 30 30 ``` 31 31 32 32 The second mechanism is to add the OpenCL driver package to ··· 50 50 51 51 Modern AMD [Graphics Core 52 52 Next](https://en.wikipedia.org/wiki/Graphics_Core_Next) (GCN) GPUs are 53 - supported through the rocm-opencl-icd package. Adding this package to 53 + supported through the rocmPackages.clr.icd package. Adding this package to 54 54 [](#opt-hardware.opengl.extraPackages) 55 55 enables OpenCL support: 56 56 57 57 ```nix 58 58 hardware.opengl.extraPackages = [ 59 - rocm-opencl-icd 59 + rocmPackages.clr.icd 60 60 ]; 61 61 ``` 62 62
+14
nixos/doc/manual/release-notes/rl-2311.section.md
··· 26 26 27 27 [`sudo-rs`]: https://github.com/memorysafety/sudo-rs/ 28 28 29 + - All [ROCm](https://rocm.docs.amd.com/en/latest/) packages have been updated to 5.7.0. 30 + - [ROCm](https://rocm.docs.amd.com/en/latest/) package attribute sets are versioned: `rocmPackages` -> `rocmPackages_5`. 31 + 29 32 ## New Services {#sec-release-23.11-new-services} 30 33 31 34 - [MCHPRS](https://github.com/MCHPR/MCHPRS), a multithreaded Minecraft server built for redstone. Available as [services.mchprs](#opt-services.mchprs.enable). ··· 147 150 - `gitlab` installations created or updated between versions \[15.11.0, 15.11.2] have an incorrect database schema. This will become a problem when upgrading to `gitlab` >=16.2.0. A workaround for affected users can be found in the [GitLab docs](https://docs.gitlab.com/ee/update/versions/gitlab_16_changes.html#undefined-column-error-upgrading-to-162-or-later). 148 151 149 152 - `consul` has been updated to `1.16.0`. See the [release note](https://github.com/hashicorp/consul/releases/tag/v1.16.0) for more details. Once a new Consul version has started and upgraded its data directory, it generally cannot be downgraded to the previous version. 153 + 154 + - `llvmPackages_rocm` has been moved to `rocmPackages.llvm`. 155 + 156 + - `hip`, `rocm-opencl-runtime`, `rocm-opencl-icd`, and `rocclr` have been combined into `rocmPackages.clr`. 157 + 158 + - `clang-ocl`, `clr`, `composable_kernel`, `hipblas`, `hipcc`, `hip-common`, `hipcub`, 159 + `hipfft`, `hipfort`, `hipify`, `hipsolver`, `hipsparse`, `migraphx`, `miopen`, `miopengemm`, 160 + `rccl`, `rdc`, `rocalution`, `rocblas`, `rocdgbapi`, `rocfft`, `rocgdb`, `rocm-cmake`, 161 + `rocm-comgr`, `rocm-core`, `rocm-device-libs`, `rocminfo`, `rocmlir`, `rocm-runtime`, 162 + `rocm-smi`, `rocm-thunk`, `rocprim`, `rocprofiler`, `rocrand`, `rocr-debug-agent`, 163 + `rocsolver`, `rocsparse`, `rocthrust`, `roctracer`, `rocwmma`, and `tensile` have been moved to `rocmPackages`. 150 164 151 165 - `himalaya` has been updated to `0.8.0`, which drops the native TLS support (in favor of Rustls) and add OAuth 2.0 support. See the [release note](https://github.com/soywod/himalaya/releases/tag/v0.8.0) for more details. 152 166
+3 -3
pkgs/applications/misc/blender/default.nix
··· 6 6 , zlib, zstd, fftw, opensubdiv, freetype, jemalloc, ocl-icd, addOpenGLRunpath 7 7 , jackaudioSupport ? false, libjack2 8 8 , cudaSupport ? config.cudaSupport, cudaPackages ? { } 9 - , hipSupport ? false, hip # comes with a significantly larger closure size 9 + , hipSupport ? false, rocmPackages # comes with a significantly larger closure size 10 10 , colladaSupport ? true, opencollada 11 11 , spaceNavSupport ? stdenv.isLinux, libspnav 12 12 , makeWrapper ··· 103 103 substituteInPlace extern/clew/src/clew.c --replace '"libOpenCL.so"' '"${ocl-icd}/lib/libOpenCL.so"' 104 104 '') + 105 105 (lib.optionalString hipSupport '' 106 - substituteInPlace extern/hipew/src/hipew.c --replace '"/opt/rocm/hip/lib/libamdhip64.so"' '"${hip}/lib/libamdhip64.so"' 107 - substituteInPlace extern/hipew/src/hipew.c --replace '"opt/rocm/hip/bin"' '"${hip}/bin"' 106 + substituteInPlace extern/hipew/src/hipew.c --replace '"/opt/rocm/hip/lib/libamdhip64.so"' '"${rocmPackages.clr}/lib/libamdhip64.so"' 107 + substituteInPlace extern/hipew/src/hipew.c --replace '"opt/rocm/hip/bin"' '"${rocmPackages.clr}/bin"' 108 108 ''); 109 109 110 110 cmakeFlags =
+9 -7
pkgs/applications/science/chemistry/cp2k/default.nix
··· 37 37 # and for Nvidia see https://github.com/cp2k/cp2k/blob/master/INSTALL.md#2i-cuda-optional-improved-performance-on-gpu-systems 38 38 , gpuVersion ? "Mi100" 39 39 , gpuArch ? "gfx908" 40 - , rocm-core 41 - , hip 42 - , hipblas 43 - , hipfft 44 - , rocblas 40 + , rocmPackages 45 41 }: 46 42 47 43 assert builtins.elem gpuBackend [ "none" "cuda" "rocm" ]; ··· 86 82 ] 87 83 ++ lib.optional enableElpa elpa 88 84 ++ lib.optional (gpuBackend == "cuda") cudaPackages.cudatoolkit 89 - ++ lib.optional (gpuBackend == "rocm") [hip rocm-core hipblas hipfft rocblas] 85 + ++ lib.optional (gpuBackend == "rocm") [ 86 + rocmPackages.clr 87 + rocmPackages.rocm-core 88 + rocmPackages.hipblas 89 + rocmPackages.hipfft 90 + rocmPackages.rocblas 91 + ] 90 92 ; 91 93 92 94 propagatedBuildInputs = [ mpi ]; ··· 126 128 ${lib.strings.optionalString (gpuBackend == "rocm") '' 127 129 GPUVER = ${gpuVersion} 128 130 OFFLOAD_CC = hipcc 129 - OFFLOAD_FLAGS = -fopenmp -m64 -pthread -fPIC -D__GRID_HIP -O2 --offload-arch=${gpuArch} --rocm-path=${rocm-core} 131 + OFFLOAD_FLAGS = -fopenmp -m64 -pthread -fPIC -D__GRID_HIP -O2 --offload-arch=${gpuArch} --rocm-path=${rocmPackages.rocm-core} 130 132 OFFLOAD_TARGET = hip 131 133 CXX = mpicxx 132 134 CXXFLAGS = -std=c++11 -fopenmp -D__HIP_PLATFORM_AMD__
+6 -5
pkgs/by-name/si/sirius/package.nix
··· 23 23 , llvmPackages 24 24 , gpuBackend ? "none" 25 25 , cudaPackages 26 - , hip 27 - , rocblas 26 + , rocmPackages 28 27 }: 29 28 30 29 assert builtins.elem gpuBackend [ "none" "cuda" "rocm" ]; ··· 67 66 libvdwxc 68 67 ] 69 68 ++ lib.optional (gpuBackend == "cuda") cudaPackages.cudatoolkit 70 - ++ lib.optionals (gpuBackend == "rocm") [ hip rocblas ] 71 - ++ lib.optional stdenv.isDarwin llvmPackages.openmp 69 + ++ lib.optionals (gpuBackend == "rocm") [ 70 + rocmPackages.clr 71 + rocmPackages.rocblas 72 + ] ++ lib.optional stdenv.isDarwin llvmPackages.openmp 72 73 ; 73 74 74 75 propagatedBuildInputs = [ mpi ]; ··· 87 88 ] 88 89 ++ lib.optionals (gpuBackend == "rocm") [ 89 90 "-DUSE_ROCM=ON" 90 - "-DHIP_ROOT_DIR=${hip}" 91 + "-DHIP_ROOT_DIR=${rocmPackages.clr}" 91 92 ]; 92 93 93 94 doCheck = true;
+7 -6
pkgs/by-name/sp/spfft/package.nix
··· 8 8 , llvmPackages 9 9 , gpuBackend ? "none" 10 10 , cudaPackages 11 - , hip 12 - , rocfft 13 - , hipfft 11 + , rocmPackages 14 12 }: 15 13 16 14 assert builtins.elem gpuBackend [ "none" "cuda" "rocm" ]; ··· 35 33 fftw 36 34 ] 37 35 ++ lib.optional (gpuBackend == "cuda") cudaPackages.cudatoolkit 38 - ++ lib.optionals (gpuBackend == "rocm") [ hip rocfft hipfft ] 39 - ++ lib.optional stdenv.isDarwin llvmPackages.openmp 36 + ++ lib.optionals (gpuBackend == "rocm") [ 37 + rocmPackages.clr 38 + rocmPackages.rocfft 39 + rocmPackages.hipfft 40 + ] ++ lib.optional stdenv.isDarwin llvmPackages.openmp 40 41 ; 41 42 42 43 propagatedBuildInputs = [ mpi ]; ··· 53 54 ++ lib.optional (gpuBackend == "cuda") "-DSPFFT_GPU_BACKEND=CUDA" 54 55 ++ lib.optionals (gpuBackend == "rocm") [ 55 56 "-DSPFFT_GPU_BACKEND=ROCM" 56 - "-DHIP_ROOT_DIR=${hip}" 57 + "-DHIP_ROOT_DIR=${rocmPackages.clr}" 57 58 ]; 58 59 59 60
+5 -4
pkgs/by-name/sp/spla/package.nix
··· 8 8 , llvmPackages 9 9 , gpuBackend ? "none" 10 10 , cudaPackages 11 - , hip 12 - , rocblas 11 + , rocmPackages 13 12 }: 14 13 15 14 assert builtins.elem gpuBackend [ "none" "cuda" "rocm" ]; ··· 39 38 blas 40 39 ] 41 40 ++ lib.optional (gpuBackend == "cuda") cudaPackages.cudatoolkit 42 - ++ lib.optionals (gpuBackend == "rocm") [ hip rocblas rocblas ] 43 - ++ lib.optional stdenv.isDarwin llvmPackages.openmp 41 + ++ lib.optionals (gpuBackend == "rocm") [ 42 + rocmPackages.clr 43 + rocmPackages.rocblas 44 + ] ++ lib.optional stdenv.isDarwin llvmPackages.openmp 44 45 ; 45 46 46 47 propagatedBuildInputs = [ mpi ];
-129
pkgs/development/compilers/hip-common/0000-fixup-paths.patch
··· 1 - diff --git a/bin/hipcc.pl b/bin/hipcc.pl 2 - index da9559b..7aaa540 100755 3 - --- a/bin/hipcc.pl 4 - +++ b/bin/hipcc.pl 5 - @@ -185,7 +185,7 @@ if ($HIP_PLATFORM eq "amd") { 6 - chomp($HIP_CLANG_TARGET); 7 - 8 - if (! defined $HIP_CLANG_INCLUDE_PATH) { 9 - - $HIP_CLANG_INCLUDE_PATH = abs_path("$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/include"); 10 - + $HIP_CLANG_INCLUDE_PATH = abs_path("@clang@/resource-root/include"); 11 - } 12 - if (! defined $HIP_INCLUDE_PATH) { 13 - $HIP_INCLUDE_PATH = "$HIP_PATH/include"; 14 - @@ -206,8 +206,8 @@ if ($HIP_PLATFORM eq "amd") { 15 - print ("HIP_CLANG_TARGET=$HIP_CLANG_TARGET\n"); 16 - } 17 - 18 - - $HIPCXXFLAGS .= " -isystem \"$HIP_CLANG_INCLUDE_PATH/..\""; 19 - - $HIPCFLAGS .= " -isystem \"$HIP_CLANG_INCLUDE_PATH/..\""; 20 - + $HIPCXXFLAGS .= " -isystem \"$HIP_CLANG_INCLUDE_PATH\""; 21 - + $HIPCFLAGS .= " -isystem \"$HIP_CLANG_INCLUDE_PATH\""; 22 - $HIPLDFLAGS .= " -L\"$HIP_LIB_PATH\""; 23 - if ($isWindows) { 24 - $HIPLDFLAGS .= " -lamdhip64"; 25 - @@ -625,7 +625,7 @@ if($HIP_PLATFORM eq "amd"){ 26 - $targetsStr = $ENV{HCC_AMDGPU_TARGET}; 27 - } elsif (not $isWindows) { 28 - # Else try using rocm_agent_enumerator 29 - - $ROCM_AGENT_ENUM = "${ROCM_PATH}/bin/rocm_agent_enumerator"; 30 - + $ROCM_AGENT_ENUM = "@rocminfo@/bin/rocm_agent_enumerator"; 31 - $targetsStr = `${ROCM_AGENT_ENUM} -t GPU`; 32 - $targetsStr =~ s/\n/,/g; 33 - } 34 - @@ -724,16 +724,16 @@ if ($HIP_PLATFORM eq "amd") { 35 - 36 - if (not $isWindows and not $compileOnly) { 37 - if ($linkType eq 0) { 38 - - $toolArgs = " -L$HIP_LIB_PATH -lamdhip64 -L$ROCM_PATH/lib -lhsa-runtime64 -ldl -lnuma " . ${toolArgs}; 39 - + $toolArgs = " -L$HIP_LIB_PATH -lamdhip64 -L@rocm_runtime@/lib -lhsa-runtime64 -ldl -lnuma " . ${toolArgs}; 40 - } else { 41 - $toolArgs = ${toolArgs} . " -Wl,-rpath=$HIP_LIB_PATH:$ROCM_PATH/lib -lamdhip64 "; 42 - } 43 - # To support __fp16 and _Float16, explicitly link with compiler-rt 44 - - $HIP_CLANG_BUILTIN_LIB="$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/lib/$HIP_CLANG_TARGET/libclang_rt.builtins.a"; 45 - + $HIP_CLANG_BUILTIN_LIB="@clang@/resource-root/lib/$HIP_CLANG_TARGET/libclang_rt.builtins.a"; 46 - if (-e $HIP_CLANG_BUILTIN_LIB) { 47 - - $toolArgs .= " -L$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/lib/$HIP_CLANG_TARGET -lclang_rt.builtins " 48 - + $toolArgs .= " -L@clang@/resource-root/lib/$HIP_CLANG_TARGET -lclang_rt.builtins " 49 - } else { 50 - - $toolArgs .= " -L$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/lib/linux -lclang_rt.builtins-x86_64 " 51 - + $toolArgs .= " -L@clang@/resource-root/lib/linux -lclang_rt.builtins-x86_64 " 52 - } 53 - } 54 - } 55 - diff --git a/bin/hipconfig.pl b/bin/hipconfig.pl 56 - index 5ddb8e9..6a76a2e 100755 57 - --- a/bin/hipconfig.pl 58 - +++ b/bin/hipconfig.pl 59 - @@ -77,7 +77,7 @@ if ($HIP_COMPILER eq "clang") { 60 - $CPP_CONFIG = " -D__HIP_PLATFORM_HCC__= -D__HIP_PLATFORM_AMD__="; 61 - 62 - $HIP_PATH_INCLUDE = $HIP_PATH."/include"; 63 - - $HIP_CLANG_INCLUDE = $HIP_CLANG_PATH."/../lib/clang/".$HIP_CLANG_VERSION; 64 - + $HIP_CLANG_INCLUDE = "@clang@/resource-root/include"; 65 - if($isWindows) { 66 - $CPP_CONFIG .= " -I\"$HIP_PATH_INCLUDE\" -I\"$HIP_CLANG_INCLUDE\""; 67 - } else { 68 - @@ -168,7 +168,7 @@ if (!$printed or $p_full) { 69 - print ("HIP_CLANG_PATH : $HIP_CLANG_PATH\n"); 70 - if ($isWindows) { 71 - system("\"$HIP_CLANG_PATH/clang++\" --version"); 72 - - system("\"$HIP_CLANG_PATH/llc\" --version"); 73 - + system("\"@llvm@/bin/llc\" --version"); 74 - printf("hip-clang-cxxflags : "); 75 - $win_output = `perl \"$HIP_PATH/bin/hipcc\" --cxxflags`; 76 - printf("$win_output \n"); 77 - @@ -177,7 +177,7 @@ if (!$printed or $p_full) { 78 - printf("$win_output \n"); 79 - } else { 80 - system("$HIP_CLANG_PATH/clang++ --version"); 81 - - system("$HIP_CLANG_PATH/llc --version"); 82 - + system("@llvm@/bin/llc --version"); 83 - print ("hip-clang-cxxflags : "); 84 - system("$HIP_PATH/bin/hipcc --cxxflags"); 85 - printf("\n"); 86 - @@ -219,8 +219,8 @@ if (!$printed or $p_full) { 87 - system ("uname -a"); 88 - } 89 - 90 - - if (-e "/usr/bin/lsb_release") { 91 - - system ("/usr/bin/lsb_release -a"); 92 - + if (-e "@lsb_release@/bin/lsb_release") { 93 - + system ("@lsb_release@/bin/lsb_release -a"); 94 - } 95 - 96 - print "\n" ; 97 - diff --git a/hip-lang-config.cmake.in b/hip-lang-config.cmake.in 98 - index 9250a68..f6e27b7 100644 99 - --- a/hip-lang-config.cmake.in 100 - +++ b/hip-lang-config.cmake.in 101 - @@ -71,8 +71,8 @@ get_filename_component(_IMPORT_PREFIX "${_DIR}/../../../" REALPATH) 102 - 103 - 104 - #need _IMPORT_PREFIX to be set #FILE_REORG_BACKWARD_COMPATIBILITY 105 - -file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS "${_IMPORT_PREFIX}/../llvm/lib/clang/*/include") 106 - -file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS_REORG "${_IMPORT_PREFIX}/llvm/lib/clang/*/include") 107 - +file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS "@clang@/resource-root/include") 108 - +file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS_REORG "@clang@/resource-root/include") 109 - find_path(HIP_CLANG_INCLUDE_PATH __clang_cuda_math.h 110 - HINTS ${HIP_CLANG_INCLUDE_SEARCH_PATHS} 111 - ${HIP_CLANG_INCLUDE_SEARCH_PATHS_REORG} 112 - @@ -89,7 +89,7 @@ find_path(HSA_HEADER hsa/hsa.h 113 - PATHS 114 - "${_IMPORT_PREFIX}/../include" #FILE_REORG_BACKWARD_COMPATIBILITY 115 - "${_IMPORT_PREFIX}/include" 116 - - "${ROCM_PATH}/include" 117 - + "@rocm_runtime@/include" 118 - ) 119 - 120 - if (NOT HSA_HEADER) 121 - @@ -97,7 +97,7 @@ if (NOT HSA_HEADER) 122 - endif() 123 - 124 - get_filename_component(HIP_COMPILER_INSTALL_PATH ${CMAKE_HIP_COMPILER} DIRECTORY) 125 - -file(GLOB HIP_CLANGRT_LIB_SEARCH_PATHS "${HIP_COMPILER_INSTALL_PATH}/../lib/clang/*/lib/*") 126 - +file(GLOB HIP_CLANGRT_LIB_SEARCH_PATHS "@clang@/resource-root/lib/*") 127 - find_library(CLANGRT_BUILTINS 128 - NAMES 129 - clang_rt.builtins
+2 -17
pkgs/development/compilers/hip-common/default.nix pkgs/development/rocm-modules/5/hip-common/default.nix
··· 2 2 , stdenv 3 3 , fetchFromGitHub 4 4 , rocmUpdateScript 5 - , substituteAll 6 - , llvm 7 - , rocm-runtime 8 - , rocminfo 9 - , lsb-release 10 5 }: 11 6 12 7 stdenv.mkDerivation (finalAttrs: { 13 8 pname = "hip-common"; 14 - version = "5.4.2"; 9 + version = "5.7.0"; 15 10 16 11 src = fetchFromGitHub { 17 12 owner = "ROCm-Developer-Tools"; 18 13 repo = "HIP"; 19 14 rev = "rocm-${finalAttrs.version}"; 20 - hash = "sha256-44CZWk6EsP5EduzBCBbOh2kshS89qOm4v3mx/xNDzV0="; 15 + hash = "sha256-1Abit9qZCwrCVcnaFT4uMygFB9G6ovRasLmTsOsJ/Fw="; 21 16 }; 22 - 23 - patches = [ 24 - (substituteAll { 25 - src = ./0000-fixup-paths.patch; 26 - inherit llvm rocminfo; 27 - clang = stdenv.cc; 28 - rocm_runtime = rocm-runtime; 29 - lsb_release = lsb-release; 30 - }) 31 - ]; 32 17 33 18 dontConfigure = true; 34 19 dontBuild = true;
-62
pkgs/development/compilers/hip/0000-fixup-paths.patch
··· 1 - diff --git a/hip-config.cmake.in b/hip-config.cmake.in 2 - index 89d1224..dc9ba05 100755 3 - --- a/hip-config.cmake.in 4 - +++ b/hip-config.cmake.in 5 - @@ -142,7 +142,7 @@ if(HIP_COMPILER STREQUAL "clang") 6 - file(TO_CMAKE_PATH "${HIP_PATH}/../lc" HIP_CLANG_ROOT) 7 - endif() 8 - else() 9 - - set(HIP_CLANG_ROOT "${ROCM_PATH}/llvm") 10 - + set(HIP_CLANG_ROOT "@clang@") 11 - endif() 12 - if(NOT HIP_CXX_COMPILER) 13 - set(HIP_CXX_COMPILER ${CMAKE_CXX_COMPILER}) 14 - @@ -171,7 +171,7 @@ if(HIP_COMPILER STREQUAL "clang") 15 - get_filename_component(_HIP_CLANG_BIN_PATH "${_HIP_CLANG_REAL_PATH}" DIRECTORY) 16 - get_filename_component(HIP_CLANG_ROOT "${_HIP_CLANG_BIN_PATH}" DIRECTORY) 17 - endif() 18 - - file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS ${HIP_CLANG_ROOT}/lib/clang/*/include) 19 - + file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS "@clang@/resource-root/include") 20 - find_path(HIP_CLANG_INCLUDE_PATH stddef.h 21 - HINTS 22 - ${HIP_CLANG_INCLUDE_SEARCH_PATHS} 23 - @@ -209,7 +209,7 @@ if(NOT WIN32) 24 - "${_IMPORT_PREFIX}/include" 25 - #FILE_REORG_BACKWARD_COMPATIBILITY ${_IMPORT_PREFIX}/../include is for Backward compatibility 26 - "${_IMPORT_PREFIX}/../include" 27 - - ${ROCM_PATH}/include 28 - + "@rocm_runtime@/include" 29 - ) 30 - 31 - if (NOT HSA_HEADER) 32 - @@ -291,7 +291,7 @@ if(HIP_COMPILER STREQUAL "clang") 33 - endif() 34 - endif() 35 - 36 - - file(GLOB HIP_CLANGRT_LIB_SEARCH_PATHS "${HIP_CLANG_ROOT}/lib/clang/*/lib/*") 37 - + file(GLOB HIP_CLANGRT_LIB_SEARCH_PATHS "@clang@/resource-root/lib/*") 38 - find_library(CLANGRT_BUILTINS 39 - NAMES 40 - clang_rt.builtins 41 - diff --git a/src/hip_embed_pch.sh b/src/hip_embed_pch.sh 42 - index 0a1572b..2feb19a 100755 43 - --- a/src/hip_embed_pch.sh 44 - +++ b/src/hip_embed_pch.sh 45 - @@ -149,7 +149,7 @@ EOF 46 - 47 - $LLVM_DIR/bin/clang -cc1 -O3 -emit-pch -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-linux-gnu -fcuda-is-device -std=c++17 -fgnuc-version=4.2.1 -o $tmp/hip_wave64.pch -x hip-cpp-output - <$tmp/pch_wave64.cui && 48 - 49 - - $LLVM_DIR/bin/llvm-mc -o hip_pch.o $tmp/hip_pch.mcin --filetype=obj && 50 - + @llvm@/bin/llvm-mc -o hip_pch.o $tmp/hip_pch.mcin --filetype=obj && 51 - 52 - rm -rf $tmp 53 - } 54 - @@ -195,7 +195,7 @@ EOF 55 - set -x 56 - $LLVM_DIR/bin/clang -O3 --rocm-path=$HIP_INC_DIR/.. -std=c++14 -nogpulib --hip-version=4.4 -isystem $HIP_INC_DIR -isystem $HIP_BUILD_INC_DIR -isystem $HIP_AMD_INC_DIR --cuda-device-only -D__HIPCC_RTC__ -x hip $tmp/hipRTC_header.h -E -o $tmp/hiprtc && 57 - cat $macroFile >> $tmp/hiprtc && 58 - - $LLVM_DIR/bin/llvm-mc -o $tmp/hiprtc_header.o $tmp/hipRTC_header.mcin --filetype=obj && 59 - + @llvm@/bin/llvm-mc -o $tmp/hiprtc_header.o $tmp/hipRTC_header.mcin --filetype=obj && 60 - $LLVM_DIR/bin/clang $tmp/hiprtc_header.o -o $rtc_shared_lib_out -shared && 61 - $LLVM_DIR/bin/clang -O3 --rocm-path=$HIP_INC_DIR/.. -std=c++14 -nogpulib -nogpuinc -emit-llvm -c -o $tmp/tmp.bc --cuda-device-only -D__HIPCC_RTC__ --offload-arch=gfx906 -x hip-cpp-output $tmp/hiprtc && 62 - rm -rf $tmp
-197
pkgs/development/compilers/hip/default.nix
··· 1 - { lib 2 - , stdenv 3 - , fetchFromGitHub 4 - , fetchpatch 5 - , rocmUpdateScript 6 - , substituteAll 7 - , makeWrapper 8 - , hip-common 9 - , hipcc 10 - , rocclr 11 - , roctracer 12 - , cmake 13 - , perl 14 - , llvm 15 - , rocminfo 16 - , rocm-thunk 17 - , rocm-comgr 18 - , rocm-device-libs 19 - , rocm-runtime 20 - , rocm-opencl-runtime 21 - , cudatoolkit 22 - , numactl 23 - , libxml2 24 - , libX11 25 - , libglvnd 26 - , doxygen 27 - , graphviz 28 - , fontconfig 29 - , python3Packages 30 - , buildDocs ? true 31 - , buildTests ? false 32 - , useNVIDIA ? false 33 - }: 34 - 35 - let 36 - hipPlatform = if useNVIDIA then "nvidia" else "amd"; 37 - 38 - wrapperArgs = [ 39 - "--prefix PATH : $out/bin" 40 - "--prefix LD_LIBRARY_PATH : ${rocm-runtime}" 41 - "--set HIP_PLATFORM ${hipPlatform}" 42 - "--set HIP_PATH $out" 43 - "--set HIP_CLANG_PATH ${stdenv.cc}/bin" 44 - "--set DEVICE_LIB_PATH ${rocm-device-libs}/amdgcn/bitcode" 45 - "--set HSA_PATH ${rocm-runtime}" 46 - "--set ROCM_PATH $out" 47 - ] ++ lib.optionals useNVIDIA [ 48 - "--set CUDA_PATH ${cudatoolkit}" 49 - ]; 50 - in stdenv.mkDerivation (finalAttrs: { 51 - pname = "hip-${hipPlatform}"; 52 - version = "5.4.4"; 53 - 54 - outputs = [ 55 - "out" 56 - ] ++ lib.optionals buildDocs [ 57 - "doc" 58 - ]; 59 - 60 - src = fetchFromGitHub { 61 - owner = "ROCm-Developer-Tools"; 62 - repo = "hipamd"; 63 - rev = "rocm-${finalAttrs.version}"; 64 - hash = "sha256-FcuylhkG7HqLYXH1J6ND6IVEIbDzHp7h7jg2ZZ4XoFM="; 65 - }; 66 - 67 - patches = [ 68 - (substituteAll { 69 - src = ./0000-fixup-paths.patch; 70 - inherit llvm; 71 - clang = stdenv.cc; 72 - rocm_runtime = rocm-runtime; 73 - }) 74 - 75 - # https://github.com/ROCm-Developer-Tools/hipamd/commit/be33ec55acc104a59d01df5912261d007c7f3ee9 76 - (fetchpatch { 77 - url = "https://github.com/ROCm-Developer-Tools/hipamd/commit/be33ec55acc104a59d01df5912261d007c7f3ee9.patch"; 78 - hash = "sha256-eTC4mUIN1FwRce1n38uDOlITFL/vpcOhvnaZTo5R7lo="; 79 - }) 80 - ]; 81 - 82 - nativeBuildInputs = [ 83 - makeWrapper 84 - cmake 85 - perl 86 - python3Packages.python 87 - python3Packages.cppheaderparser 88 - ] ++ lib.optionals buildDocs [ 89 - doxygen 90 - graphviz 91 - fontconfig 92 - ]; 93 - 94 - buildInputs = [ 95 - numactl 96 - libxml2 97 - libX11 98 - libglvnd 99 - ]; 100 - 101 - propagatedBuildInputs = [ 102 - stdenv.cc 103 - llvm 104 - rocminfo 105 - rocm-thunk 106 - rocm-comgr 107 - rocm-device-libs 108 - rocm-runtime 109 - rocm-opencl-runtime 110 - ] ++ lib.optionals useNVIDIA [ 111 - cudatoolkit 112 - ]; 113 - 114 - cmakeFlags = [ 115 - "-DROCM_PATH=${rocminfo}" 116 - "-DHIP_PLATFORM=${hipPlatform}" 117 - "-DHIP_COMMON_DIR=${hip-common}" 118 - "-DHIPCC_BIN_DIR=${hipcc}/bin" 119 - "-DHIP_LLVM_ROOT=${stdenv.cc}" 120 - "-DROCCLR_PATH=${rocclr}" 121 - "-DAMD_OPENCL_PATH=${rocm-opencl-runtime.src}" 122 - "-DPROF_API_HEADER_PATH=${roctracer.src}/inc/ext" 123 - # Temporarily set variables to work around upstream CMakeLists issue 124 - # Can be removed once https://github.com/ROCm-Developer-Tools/hipamd/issues/55 is fixed 125 - "-DCMAKE_INSTALL_BINDIR=bin" 126 - "-DCMAKE_INSTALL_INCLUDEDIR=include" 127 - "-DCMAKE_INSTALL_LIBDIR=lib" 128 - ] ++ lib.optionals buildTests [ 129 - "-DHIP_CATCH_TEST=1" 130 - ]; 131 - 132 - postPatch = '' 133 - export HIP_CLANG_PATH=${stdenv.cc}/bin 134 - patchShebangs src 135 - '' + lib.optionalString buildDocs '' 136 - export HOME=$(mktemp -d) 137 - export FONTCONFIG_FILE=${fontconfig.out}/etc/fonts/fonts.conf 138 - ''; 139 - 140 - doCheck = buildTests; 141 - checkTarget = "build_tests"; 142 - 143 - preCheck = lib.optionalString buildTests '' 144 - export ROCM_PATH=$PWD 145 - export DEVICE_LIB_PATH=${rocm-device-libs}/amdgcn/bitcode 146 - patchShebangs bin 147 - ''; 148 - 149 - postInstall = '' 150 - patchShebangs $out/bin 151 - cp -a $out/bin/hipcc $out/bin/hipcc-pl 152 - cp -a $out/bin/hipconfig $out/bin/hipconfig-pl 153 - wrapProgram $out/bin/hipcc --set HIP_USE_PERL_SCRIPTS 0 154 - wrapProgram $out/bin/hipconfig --set HIP_USE_PERL_SCRIPTS 0 155 - wrapProgram $out/bin/hipcc.bin ${lib.concatStringsSep " " wrapperArgs} 156 - wrapProgram $out/bin/hipconfig.bin ${lib.concatStringsSep " " wrapperArgs} 157 - wrapProgram $out/bin/hipcc-pl --set HIP_USE_PERL_SCRIPTS 1 158 - wrapProgram $out/bin/hipconfig-pl --set HIP_USE_PERL_SCRIPTS 1 159 - wrapProgram $out/bin/hipcc.pl ${lib.concatStringsSep " " wrapperArgs} 160 - wrapProgram $out/bin/hipconfig.pl ${lib.concatStringsSep " " wrapperArgs} 161 - ''; 162 - 163 - passthru = { 164 - # All known and valid general GPU targets 165 - # We cannot use this for each ROCm library, as each defines their own supported targets 166 - # See: https://github.com/RadeonOpenCompute/ROCm/blob/77cbac4abab13046ee93d8b5bf410684caf91145/README.md#library-target-matrix 167 - gpuTargets = lib.forEach [ 168 - "803" 169 - "900" 170 - "906" 171 - "908" 172 - "90a" 173 - "1010" 174 - "1012" 175 - "1030" 176 - ] (target: "gfx${target}"); 177 - 178 - updateScript = rocmUpdateScript { 179 - name = finalAttrs.pname; 180 - owner = finalAttrs.src.owner; 181 - repo = finalAttrs.src.repo; 182 - }; 183 - }; 184 - 185 - meta = with lib; { 186 - description = "C++ Heterogeneous-Compute Interface for Portability specifically for AMD platform"; 187 - homepage = "https://github.com/ROCm-Developer-Tools/hipamd"; 188 - license = with licenses; [ mit ]; 189 - maintainers = with maintainers; [ lovesegfault ] ++ teams.rocm.members; 190 - platforms = platforms.linux; 191 - # Tests require GPU, also include issues 192 - broken = 193 - versions.minor finalAttrs.version != versions.minor hip-common.version || 194 - versions.minor finalAttrs.version != versions.minor hipcc.version || 195 - buildTests; 196 - }; 197 - })
-130
pkgs/development/compilers/hipcc/0000-fixup-paths.patch
··· 1 - diff --git a/CMakeLists.txt b/CMakeLists.txt 2 - index c21f247..5bd3e45 100644 3 - --- a/CMakeLists.txt 4 - +++ b/CMakeLists.txt 5 - @@ -17,6 +17,6 @@ if (NOT WIN32) # C++17 does not require the std lib linking 6 - target_link_libraries(hipconfig.bin ${LINK_LIBS} ) # for hipconfig.bin 7 - endif() 8 - 9 - -set(HIP_VERSION_MAJOR 4 PARENT_SCOPE) 10 - -set(HIP_VERSION_MINOR 4 PARENT_SCOPE) 11 - -set(HIP_VERSION_PATCH 4 PARENT_SCOPE) 12 - +set(HIP_VERSION_MAJOR @version_major@) 13 - +set(HIP_VERSION_MINOR @version_minor@) 14 - +set(HIP_VERSION_PATCH @version_patch@) 15 - diff --git a/src/hipBin_amd.h b/src/hipBin_amd.h 16 - index f94e4a5..f0b1b83 100644 17 - --- a/src/hipBin_amd.h 18 - +++ b/src/hipBin_amd.h 19 - @@ -207,7 +207,7 @@ void HipBinAmd::initializeHipCXXFlags() { 20 - hipClangIncludePath = getCompilerIncludePath(); 21 - hipCXXFlags += " -isystem \"" + hipClangIncludePath; 22 - fs::path hipCXXFlagsTempFs = hipCXXFlags; 23 - - hipCXXFlagsTempFs /= "..\""; 24 - + hipCXXFlagsTempFs /= "\""; 25 - hipCXXFlags = hipCXXFlagsTempFs.string(); 26 - const EnvVariables& var = getEnvVariables(); 27 - // Allow __fp16 as function parameter and return type. 28 - @@ -266,7 +266,7 @@ void HipBinAmd::printCompilerInfo() const { 29 - string cmd = hipClangPath + "/clang++ --version"; 30 - system(cmd.c_str()); // hipclang version 31 - cout << "llc-version :" << endl; 32 - - cmd = hipClangPath + "/llc --version"; 33 - + cmd = "@llvm@/bin/llc --version"; 34 - system(cmd.c_str()); // llc version 35 - cout << "hip-clang-cxxflags :" << endl; 36 - cmd = hipPath + "/bin/hipcc --cxxflags"; 37 - @@ -278,7 +278,7 @@ void HipBinAmd::printCompilerInfo() const { 38 - } else { 39 - string cmd = hipClangPath + "/clang++ --version"; 40 - system(cmd.c_str()); // hipclang version 41 - - cmd = hipClangPath + "/llc --version"; 42 - + cmd = "@llvm@/bin/llc --version"; 43 - system(cmd.c_str()); // llc version 44 - cout << "hip-clang-cxxflags :" << endl; 45 - cmd = hipPath + "/bin/hipcc --cxxflags"; 46 - @@ -331,10 +331,7 @@ string HipBinAmd::getCppConfig() { 47 - hipPathInclude /= "include"; 48 - 49 - const string& compilerPath = getCompilerPath(); 50 - - hipClangInclude = compilerPath; 51 - - hipClangInclude = hipClangInclude.parent_path(); 52 - - hipClangInclude /= "lib/clang/"; 53 - - hipClangInclude /= compilerVersion; 54 - + hipClangInclude = "@clang@/resource-root/include"; 55 - string hipClangPath = hipClangInclude.string(); 56 - 57 - const OsType& osInfo = getOSInfo(); 58 - @@ -442,17 +439,7 @@ string HipBinAmd::getHipCC() const { 59 - 60 - 61 - string HipBinAmd::getCompilerIncludePath() { 62 - - string hipClangVersion, includePath, compilerIncludePath; 63 - - const string& hipClangPath = getCompilerPath(); 64 - - hipClangVersion = getCompilerVersion(); 65 - - fs::path includePathfs = hipClangPath; 66 - - includePathfs = includePathfs.parent_path(); 67 - - includePathfs /= "lib/clang/"; 68 - - includePathfs /= hipClangVersion; 69 - - includePathfs /= "include"; 70 - - includePathfs = fs::absolute(includePathfs).string(); 71 - - compilerIncludePath = includePathfs.string(); 72 - - return compilerIncludePath; 73 - + return "@clang@/resource-root/include"; 74 - } 75 - 76 - 77 - @@ -506,8 +493,8 @@ void HipBinAmd::printFull() { 78 - cout << endl << "== Envirnoment Variables" << endl; 79 - printEnvironmentVariables(); 80 - getSystemInfo(); 81 - - if (fs::exists("/usr/bin/lsb_release")) 82 - - system("/usr/bin/lsb_release -a"); 83 - + if (fs::exists("@lsb_release@/bin/lsb_release")) 84 - + system("@lsb_release@/bin/lsb_release -a"); 85 - cout << endl; 86 - } 87 - 88 - @@ -993,7 +980,7 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) { 89 - } else if (os != windows) { 90 - // Else try using rocm_agent_enumerator 91 - string ROCM_AGENT_ENUM; 92 - - ROCM_AGENT_ENUM = roccmPath + "/bin/rocm_agent_enumerator"; 93 - + ROCM_AGENT_ENUM = "@rocminfo@/bin/rocm_agent_enumerator"; 94 - targetsStr = ROCM_AGENT_ENUM +" -t GPU"; 95 - SystemCmdOut sysOut = hipBinUtilPtr_->exec(targetsStr.c_str()); 96 - regex toReplace("\n+"); 97 - @@ -1097,7 +1084,7 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) { 98 - string hipClangVersion, toolArgTemp; 99 - if (linkType == 0) { 100 - toolArgTemp = " -L"+ hipLibPath + "-lamdhip64 -L" + 101 - - roccmPath+ "/lib -lhsa-runtime64 -ldl -lnuma " + toolArgs; 102 - + "@rocm_runtime@/lib -lhsa-runtime64 -ldl -lnuma " + toolArgs; 103 - toolArgs = toolArgTemp; 104 - } else { 105 - toolArgTemp = toolArgs + " -Wl,--enable-new-dtags -Wl,-rpath=" + hipLibPath + ":" 106 - @@ -1107,8 +1094,7 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) { 107 - 108 - hipClangVersion = getCompilerVersion(); 109 - // To support __fp16 and _Float16, explicitly link with compiler-rt 110 - - toolArgs += " -L" + hipClangPath + "/../lib/clang/" + 111 - - hipClangVersion + "/lib/linux -lclang_rt.builtins-x86_64 "; 112 - + toolArgs += " -L@clang@/resource-root/lib/linux -lclang_rt.builtins-x86_64 "; 113 - } 114 - if (!var.hipccCompileFlagsAppendEnv_.empty()) { 115 - HIPCXXFLAGS += " " + var.hipccCompileFlagsAppendEnv_ + " "; 116 - diff --git a/src/hipBin_nvidia.h b/src/hipBin_nvidia.h 117 - index 6feb315..b61739d 100644 118 - --- a/src/hipBin_nvidia.h 119 - +++ b/src/hipBin_nvidia.h 120 - @@ -157,8 +157,8 @@ void HipBinNvidia::printFull() { 121 - cout << endl << "== Envirnoment Variables" << endl; 122 - printEnvironmentVariables(); 123 - getSystemInfo(); 124 - - if (fs::exists("/usr/bin/lsb_release")) 125 - - system("/usr/bin/lsb_release -a"); 126 - + if (fs::exists("@lsb_release@/bin/lsb_release")) 127 - + system("@lsb_release@/bin/lsb_release -a"); 128 - } 129 - 130 - // returns hip include
-62
pkgs/development/compilers/hipcc/default.nix
··· 1 - { lib 2 - , stdenv 3 - , fetchFromGitHub 4 - , rocmUpdateScript 5 - , substituteAll 6 - , cmake 7 - , llvm 8 - , rocm-runtime 9 - , rocminfo 10 - , lsb-release 11 - }: 12 - 13 - stdenv.mkDerivation (finalAttrs: { 14 - pname = "hipcc"; 15 - version = "5.4.2"; 16 - 17 - src = fetchFromGitHub { 18 - owner = "ROCm-Developer-Tools"; 19 - repo = "HIPCC"; 20 - rev = "rocm-${finalAttrs.version}"; 21 - hash = "sha256-PEwue4O43MiMkF8UmTeHsmlikBG2V3/nFQLKmtHrRWQ="; 22 - }; 23 - 24 - patches = [ 25 - (substituteAll { 26 - src = ./0000-fixup-paths.patch; 27 - inherit llvm rocminfo; 28 - version_major = lib.versions.major finalAttrs.version; 29 - version_minor = lib.versions.minor finalAttrs.version; 30 - version_patch = lib.versions.patch finalAttrs.version; 31 - clang = stdenv.cc; 32 - rocm_runtime = rocm-runtime; 33 - lsb_release = lsb-release; 34 - }) 35 - ]; 36 - 37 - nativeBuildInputs = [ cmake ]; 38 - 39 - installPhase = '' 40 - runHook preInstall 41 - 42 - mkdir -p $out/bin 43 - mv *.bin $out/bin 44 - 45 - runHook postInstall 46 - ''; 47 - 48 - passthru.updateScript = rocmUpdateScript { 49 - name = finalAttrs.pname; 50 - owner = finalAttrs.src.owner; 51 - repo = finalAttrs.src.repo; 52 - }; 53 - 54 - meta = with lib; { 55 - description = "Compiler driver utility that calls clang or nvcc"; 56 - homepage = "https://github.com/ROCm-Developer-Tools/HIPCC"; 57 - license = with licenses; [ mit ]; 58 - maintainers = with maintainers; [ lovesegfault ] ++ teams.rocm.members; 59 - platforms = platforms.linux; 60 - broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 61 - }; 62 - })
+8 -7
pkgs/development/compilers/hipify/default.nix pkgs/development/rocm-modules/5/hipify/default.nix
··· 3 3 , fetchFromGitHub 4 4 , rocmUpdateScript 5 5 , cmake 6 + , clang 6 7 , libxml2 7 8 }: 8 9 9 10 stdenv.mkDerivation (finalAttrs: { 10 11 pname = "hipify"; 11 - version = "5.4.2"; 12 + version = "5.7.0"; 12 13 13 14 src = fetchFromGitHub { 14 15 owner = "ROCm-Developer-Tools"; 15 16 repo = "HIPIFY"; 16 17 rev = "rocm-${finalAttrs.version}"; 17 - hash = "sha256-EaHtI1ywjEHioWptuHvCllJ3dENtSClVoE6NpWTOa9I="; 18 + hash = "sha256-lCQ2VTUGmFC90Xu70/tvoeDhFaInGqLT3vC2A1UojNI="; 18 19 }; 19 20 20 21 nativeBuildInputs = [ cmake ]; ··· 22 23 23 24 postPatch = '' 24 25 substituteInPlace CMakeLists.txt \ 25 - --replace "\''${LLVM_TOOLS_BINARY_DIR}/clang" "${stdenv.cc}/bin/clang" 26 + --replace "\''${LLVM_TOOLS_BINARY_DIR}/clang" "${clang}/bin/clang" 26 27 ''; 27 28 28 29 passthru.updateScript = rocmUpdateScript { ··· 31 32 repo = finalAttrs.src.repo; 32 33 }; 33 34 34 - # Fixup weird install paths 35 + # Fixup bad symlinks 35 36 postInstall = '' 36 - mkdir -p $out/bin 37 - mv $out/{*.sh,hipify-*} $out/bin 38 - cp -afs $out/bin $out/hip 37 + rm -r $out/hip/bin 38 + ln -s $out/bin $out/hip/bin 39 + patchShebangs $out/bin 39 40 ''; 40 41 41 42 meta = with lib; {
-18
pkgs/development/compilers/llvm/rocm/0000-fix-openmp.patch
··· 1 - diff --git a/libomptarget/plugins/amdgpu/impl/impl.cpp b/libomptarget/plugins/amdgpu/impl/impl.cpp 2 - index 80e024789..3a14e0889 100644 3 - --- a/libomptarget/plugins/amdgpu/impl/impl.cpp 4 - +++ b/libomptarget/plugins/amdgpu/impl/impl.cpp 5 - @@ -21,10 +21,11 @@ bool is_locked(void *ptr, hsa_status_t *err_p, void **agentBaseAddress) { 6 - info.size = sizeof(hsa_amd_pointer_info_t); 7 - err = hsa_amd_pointer_info(ptr, &info, nullptr, nullptr, nullptr); 8 - 9 - - if (err != HSA_STATUS_SUCCESS) 10 - + if (err != HSA_STATUS_SUCCESS) { 11 - DP("Error when getting pointer info\n"); 12 - - else 13 - + } else { 14 - is_locked = (info.type == HSA_EXT_POINTER_TYPE_LOCKED); 15 - + } 16 - 17 - if (is_locked && agentBaseAddress != nullptr) { 18 - // When user passes in a basePtr+offset we need to fix the
-603
pkgs/development/compilers/llvm/rocm/default.nix
··· 1 - { lib 2 - , stdenv 3 - , callPackage 4 - , overrideCC 5 - , wrapCCWith 6 - , wrapBintoolsWith 7 - , runCommand 8 - , lit 9 - , glibc 10 - , spirv-llvm-translator 11 - , xz 12 - , swig 13 - , lua5_3 14 - , gtest 15 - , hip 16 - , rocm-comgr 17 - , vulkan-loader 18 - , vulkan-headers 19 - , glslang 20 - , shaderc 21 - , perl 22 - , rocm-device-libs 23 - , rocm-runtime 24 - , elfutils 25 - , python3Packages 26 - }: 27 - 28 - let 29 - # Stage 1 30 - # Base 31 - llvm = callPackage ./llvm.nix { 32 - requiredSystemFeatures = [ "big-parallel" ]; 33 - isBroken = stdenv.isAarch64; # https://github.com/RadeonOpenCompute/ROCm/issues/1831#issuecomment-1278205344 34 - }; 35 - 36 - # Projects 37 - clang-unwrapped = callPackage ./llvm.nix rec { 38 - targetName = "clang"; 39 - targetDir = targetName; 40 - extraBuildInputs = [ llvm ]; 41 - 42 - extraCMakeFlags = [ 43 - "-DCMAKE_POLICY_DEFAULT_CMP0116=NEW" 44 - "-DCLANG_INCLUDE_DOCS=ON" 45 - "-DCLANG_INCLUDE_TESTS=ON" 46 - ]; 47 - 48 - extraPostPatch = '' 49 - # Looks like they forgot to add finding libedit to the standalone build 50 - ln -s ../cmake/Modules/FindLibEdit.cmake cmake/modules 51 - 52 - substituteInPlace CMakeLists.txt \ 53 - --replace "include(CheckIncludeFile)" "include(CheckIncludeFile)''\nfind_package(LibEdit)" 54 - 55 - # `No such file or directory: '/build/source/clang/tools/scan-build/bin/scan-build'` 56 - rm test/Analysis/scan-build/*.test 57 - rm test/Analysis/scan-build/rebuild_index/rebuild_index.test 58 - 59 - # `does not depend on a module exporting 'baz.h'` 60 - rm test/Modules/header-attribs.cpp 61 - 62 - # `fatal error: 'stdio.h' file not found` 63 - rm test/OpenMP/amdgcn_emit_llvm.c 64 - ''; 65 - 66 - extraPostInstall = '' 67 - mv bin/clang-tblgen $out/bin 68 - ''; 69 - }; 70 - 71 - lld = callPackage ./llvm.nix rec { 72 - buildMan = false; # No man pages to build 73 - targetName = "lld"; 74 - targetDir = targetName; 75 - extraBuildInputs = [ llvm ]; 76 - extraCMakeFlags = [ "-DCMAKE_POLICY_DEFAULT_CMP0116=NEW" ]; 77 - checkTargets = [ "check-lld" ]; 78 - }; 79 - 80 - # Runtimes 81 - runtimes = callPackage ./llvm.nix { 82 - buildDocs = false; 83 - buildMan = false; 84 - buildTests = false; 85 - targetDir = "runtimes"; 86 - 87 - targetRuntimes = [ 88 - # "libc" https://github.com/llvm/llvm-project/issues/57719 89 - "libunwind" 90 - "libcxxabi" 91 - "libcxx" 92 - "compiler-rt" 93 - ]; 94 - 95 - extraBuildInputs = [ llvm ]; 96 - 97 - extraCMakeFlags = [ 98 - "-DCMAKE_POLICY_DEFAULT_CMP0114=NEW" 99 - "-DLIBCXX_INCLUDE_BENCHMARKS=OFF" 100 - "-DLIBCXX_CXX_ABI=libcxxabi" 101 - ]; 102 - 103 - extraLicenses = [ lib.licenses.mit ]; 104 - }; 105 - 106 - # Stage 2 107 - # Helpers 108 - rStdenv = overrideCC stdenv (wrapCCWith rec { 109 - inherit bintools; 110 - libcxx = runtimes; 111 - cc = clang-unwrapped; 112 - 113 - extraPackages = [ 114 - llvm 115 - lld 116 - ]; 117 - 118 - nixSupport.cc-cflags = [ 119 - "-resource-dir=$out/resource-root" 120 - "-fuse-ld=lld" 121 - "-rtlib=compiler-rt" 122 - "-unwindlib=libunwind" 123 - "-Wno-unused-command-line-argument" 124 - ]; 125 - 126 - extraBuildCommands = '' 127 - clang_version=`${cc}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"` 128 - mkdir -p $out/resource-root 129 - ln -s ${cc}/lib/clang/$clang_version/include $out/resource-root 130 - ln -s ${runtimes}/lib $out/resource-root 131 - ''; 132 - }); 133 - 134 - bintools = wrapBintoolsWith { bintools = bintools-unwrapped; }; 135 - 136 - bintools-unwrapped = runCommand "rocm-llvm-binutils-${llvm.version}" { preferLocalBuild = true; } '' 137 - mkdir -p $out/bin 138 - 139 - for prog in ${lld}/bin/*; do 140 - ln -s $prog $out/bin/$(basename $prog) 141 - done 142 - 143 - for prog in ${llvm}/bin/*; do 144 - ln -sf $prog $out/bin/$(basename $prog) 145 - done 146 - 147 - ln -s ${llvm}/bin/llvm-ar $out/bin/ar 148 - ln -s ${llvm}/bin/llvm-as $out/bin/as 149 - ln -s ${llvm}/bin/llvm-dwp $out/bin/dwp 150 - ln -s ${llvm}/bin/llvm-nm $out/bin/nm 151 - ln -s ${llvm}/bin/llvm-objcopy $out/bin/objcopy 152 - ln -s ${llvm}/bin/llvm-objdump $out/bin/objdump 153 - ln -s ${llvm}/bin/llvm-ranlib $out/bin/ranlib 154 - ln -s ${llvm}/bin/llvm-readelf $out/bin/readelf 155 - ln -s ${llvm}/bin/llvm-size $out/bin/size 156 - ln -s ${llvm}/bin/llvm-strip $out/bin/strip 157 - ln -s ${lld}/bin/lld $out/bin/ld 158 - ''; 159 - in rec { 160 - inherit 161 - llvm 162 - clang-unwrapped 163 - lld 164 - bintools 165 - bintools-unwrapped; 166 - 167 - # Runtimes 168 - libc = callPackage ./llvm.nix rec { 169 - stdenv = rStdenv; 170 - targetName = "libc"; 171 - targetDir = "runtimes"; 172 - targetRuntimes = [ targetName ]; 173 - isBroken = true; # https://github.com/llvm/llvm-project/issues/57719 174 - }; 175 - 176 - libunwind = callPackage ./llvm.nix rec { 177 - stdenv = rStdenv; 178 - buildMan = false; # No man pages to build 179 - targetName = "libunwind"; 180 - targetDir = "runtimes"; 181 - targetRuntimes = [ targetName ]; 182 - 183 - extraCMakeFlags = [ 184 - "-DLIBUNWIND_INCLUDE_DOCS=ON" 185 - "-DLIBUNWIND_INCLUDE_TESTS=ON" 186 - "-DLIBUNWIND_USE_COMPILER_RT=ON" 187 - ]; 188 - }; 189 - 190 - libcxxabi = callPackage ./llvm.nix rec { 191 - stdenv = rStdenv; 192 - buildDocs = false; # No documentation to build 193 - buildMan = false; # No man pages to build 194 - targetName = "libcxxabi"; 195 - targetDir = "runtimes"; 196 - 197 - targetRuntimes = [ 198 - "libunwind" 199 - targetName 200 - "libcxx" 201 - ]; 202 - 203 - extraCMakeFlags = [ 204 - "-DLIBCXXABI_INCLUDE_TESTS=ON" 205 - "-DLIBCXXABI_USE_LLVM_UNWINDER=ON" 206 - "-DLIBCXXABI_USE_COMPILER_RT=ON" 207 - 208 - # Workaround having to build combined 209 - "-DLIBUNWIND_INCLUDE_DOCS=OFF" 210 - "-DLIBUNWIND_INCLUDE_TESTS=OFF" 211 - "-DLIBUNWIND_USE_COMPILER_RT=ON" 212 - "-DLIBUNWIND_INSTALL_LIBRARY=OFF" 213 - "-DLIBUNWIND_INSTALL_HEADERS=OFF" 214 - "-DLIBCXX_INCLUDE_DOCS=OFF" 215 - "-DLIBCXX_INCLUDE_TESTS=OFF" 216 - "-DLIBCXX_USE_COMPILER_RT=ON" 217 - "-DLIBCXX_CXX_ABI=libcxxabi" 218 - "-DLIBCXX_INSTALL_LIBRARY=OFF" 219 - "-DLIBCXX_INSTALL_HEADERS=OFF" 220 - ]; 221 - }; 222 - 223 - libcxx = callPackage ./llvm.nix rec { 224 - stdenv = rStdenv; 225 - buildMan = false; # No man pages to build 226 - targetName = "libcxx"; 227 - targetDir = "runtimes"; 228 - 229 - targetRuntimes = [ 230 - "libunwind" 231 - "libcxxabi" 232 - targetName 233 - ]; 234 - 235 - extraCMakeFlags = [ 236 - "-DLIBCXX_INCLUDE_DOCS=ON" 237 - "-DLIBCXX_INCLUDE_TESTS=ON" 238 - "-DLIBCXX_USE_COMPILER_RT=ON" 239 - "-DLIBCXX_CXX_ABI=libcxxabi" 240 - 241 - # Workaround having to build combined 242 - "-DLIBUNWIND_INCLUDE_DOCS=OFF" 243 - "-DLIBUNWIND_INCLUDE_TESTS=OFF" 244 - "-DLIBUNWIND_USE_COMPILER_RT=ON" 245 - "-DLIBUNWIND_INSTALL_LIBRARY=OFF" 246 - "-DLIBUNWIND_INSTALL_HEADERS=OFF" 247 - "-DLIBCXXABI_INCLUDE_TESTS=OFF" 248 - "-DLIBCXXABI_USE_LLVM_UNWINDER=ON" 249 - "-DLIBCXXABI_USE_COMPILER_RT=ON" 250 - "-DLIBCXXABI_INSTALL_LIBRARY=OFF" 251 - "-DLIBCXXABI_INSTALL_HEADERS=OFF" 252 - ]; 253 - 254 - # Most of these can't find `bash` or `mkdir`, might just be hard-coded paths, or PATH is altered 255 - extraPostPatch = '' 256 - chmod +w -R ../libcxx/test/{libcxx,std} 257 - rm -rf ../libcxx/test/libcxx/input.output/filesystems 258 - rm ../libcxx/test/libcxx/selftest/remote-substitutions.sh.cpp 259 - rm ../libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/pbackfail.pass.cpp 260 - rm ../libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/pbackfail.pass.cpp 261 - rm ../libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp 262 - rm ../libcxx/test/std/utilities/optional/optional.object/optional.object.assign/nullopt_t.pass.cpp 263 - rm -rf ../libcxx/test/std/utilities/optional/optional.object/optional.object.ctor 264 - rm -rf ../libcxx/test/std/input.output/filesystems/{class.directory_entry,class.directory_iterator,class.rec.dir.itr,fs.op.funcs} 265 - ''; 266 - }; 267 - 268 - compiler-rt = callPackage ./llvm.nix rec { 269 - stdenv = rStdenv; 270 - buildDocs = false; # No documentation to build 271 - buildMan = false; # No man pages to build 272 - targetName = "compiler-rt"; 273 - targetDir = "runtimes"; 274 - 275 - targetRuntimes = [ 276 - "libunwind" 277 - "libcxxabi" 278 - "libcxx" 279 - targetName 280 - ]; 281 - 282 - extraCMakeFlags = [ 283 - "-DCMAKE_POLICY_DEFAULT_CMP0114=NEW" 284 - "-DCOMPILER_RT_INCLUDE_TESTS=ON" 285 - "-DCOMPILER_RT_USE_LLVM_UNWINDER=ON" 286 - "-DCOMPILER_RT_CXX_LIBRARY=libcxx" 287 - "-DCOMPILER_RT_CAN_EXECUTE_TESTS=OFF" # We can't run most of these 288 - 289 - # Workaround having to build combined 290 - "-DLIBUNWIND_INCLUDE_DOCS=OFF" 291 - "-DLIBUNWIND_INCLUDE_TESTS=OFF" 292 - "-DLIBUNWIND_USE_COMPILER_RT=ON" 293 - "-DLIBUNWIND_INSTALL_LIBRARY=OFF" 294 - "-DLIBUNWIND_INSTALL_HEADERS=OFF" 295 - "-DLIBCXXABI_INCLUDE_TESTS=OFF" 296 - "-DLIBCXXABI_USE_LLVM_UNWINDER=ON" 297 - "-DLIBCXXABI_USE_COMPILER_RT=ON" 298 - "-DLIBCXXABI_INSTALL_LIBRARY=OFF" 299 - "-DLIBCXXABI_INSTALL_HEADERS=OFF" 300 - "-DLIBCXX_INCLUDE_DOCS=OFF" 301 - "-DLIBCXX_INCLUDE_TESTS=OFF" 302 - "-DLIBCXX_USE_COMPILER_RT=ON" 303 - "-DLIBCXX_CXX_ABI=libcxxabi" 304 - "-DLIBCXX_INSTALL_LIBRARY=OFF" 305 - "-DLIBCXX_INSTALL_HEADERS=OFF" 306 - ]; 307 - 308 - extraPostPatch = '' 309 - # `No such file or directory: 'ldd'` 310 - substituteInPlace ../compiler-rt/test/lit.common.cfg.py \ 311 - --replace "'ldd'," "'${glibc.bin}/bin/ldd'," 312 - 313 - # We can run these 314 - substituteInPlace ../compiler-rt/test/CMakeLists.txt \ 315 - --replace "endfunction()" "endfunction()''\nadd_subdirectory(builtins)''\nadd_subdirectory(shadowcallstack)" 316 - ''; 317 - 318 - extraLicenses = [ lib.licenses.mit ]; 319 - }; 320 - 321 - # Stage 3 322 - # Helpers 323 - rocmClangStdenv = overrideCC stdenv clang; 324 - 325 - clang = wrapCCWith rec { 326 - # inherit libc libcxx bintools; 327 - inherit libcxx bintools; 328 - 329 - # We do this to avoid HIP pathing problems, and mimic a monolithic install 330 - cc = stdenv.mkDerivation (finalAttrs: { 331 - inherit (clang-unwrapped) pname version; 332 - dontUnpack = true; 333 - 334 - installPhase = '' 335 - runHook preInstall 336 - 337 - clang_version=`${clang-unwrapped}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"` 338 - mkdir -p $out/{bin,include/c++/v1,lib/{cmake,clang/$clang_version/{include,lib}},libexec,share} 339 - 340 - for path in ${llvm} ${clang-unwrapped} ${lld} ${libunwind} ${libcxxabi} ${libcxx} ${compiler-rt}; do 341 - cp -as $path/* $out 342 - chmod +w $out/{*,include/c++/v1,lib/{clang/$clang_version/include,cmake}} 343 - rm -f $out/lib/libc++.so 344 - done 345 - 346 - ln -s $out/lib/* $out/lib/clang/$clang_version/lib 347 - ln -s $out/include/* $out/lib/clang/$clang_version/include 348 - 349 - runHook postInstall 350 - ''; 351 - 352 - passthru.isClang = true; 353 - }); 354 - 355 - extraPackages = [ 356 - llvm 357 - lld 358 - libunwind 359 - libcxxabi 360 - compiler-rt 361 - ]; 362 - 363 - nixSupport.cc-cflags = [ 364 - "-resource-dir=$out/resource-root" 365 - "-fuse-ld=lld" 366 - "-rtlib=compiler-rt" 367 - "-unwindlib=libunwind" 368 - "-Wno-unused-command-line-argument" 369 - ]; 370 - 371 - extraBuildCommands = '' 372 - clang_version=`${cc}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"` 373 - mkdir -p $out/resource-root 374 - ln -s ${cc}/lib/clang/$clang_version/{include,lib} $out/resource-root 375 - 376 - # Not sure why, but hardening seems to make things break 377 - rm $out/nix-support/add-hardening.sh 378 - touch $out/nix-support/add-hardening.sh 379 - 380 - # GPU compilation uses builtin `lld` 381 - substituteInPlace $out/bin/{clang,clang++} \ 382 - --replace "-MM) dontLink=1 ;;" "-MM | --cuda-device-only) dontLink=1 ;;''\n--cuda-host-only | --cuda-compile-host-device) dontLink=0 ;;" 383 - ''; 384 - }; 385 - 386 - # Base 387 - # Unfortunately, we cannot build `clang-tools-extra` separately. 388 - clang-tools-extra = callPackage ./llvm.nix { 389 - stdenv = rocmClangStdenv; 390 - buildTests = false; # `invalid operands to binary expression ('std::basic_stringstream<char>' and 'const llvm::StringRef')` 391 - targetName = "clang-tools-extra"; 392 - 393 - targetProjects = [ 394 - "clang" 395 - "clang-tools-extra" 396 - ]; 397 - 398 - extraBuildInputs = [ gtest ]; 399 - 400 - extraCMakeFlags = [ 401 - "-DLLVM_INCLUDE_DOCS=OFF" 402 - "-DLLVM_INCLUDE_TESTS=OFF" 403 - "-DCLANG_INCLUDE_DOCS=OFF" 404 - "-DCLANG_INCLUDE_TESTS=ON" 405 - "-DCLANG_TOOLS_EXTRA_INCLUDE_DOCS=ON" 406 - ]; 407 - 408 - extraPostInstall = '' 409 - # Remove LLVM and Clang 410 - for path in `find ${llvm} ${clang-unwrapped}`; do 411 - if [ $path != ${llvm} ] && [ $path != ${clang-unwrapped} ]; then 412 - rm -f $out''${path#${llvm}} $out''${path#${clang-unwrapped}} || true 413 - fi 414 - done 415 - 416 - # Cleanup empty directories 417 - find $out -type d -empty -delete 418 - ''; 419 - }; 420 - 421 - # Projects 422 - libclc = let 423 - spirv = (spirv-llvm-translator.override { inherit llvm; }); 424 - in callPackage ./llvm.nix rec { 425 - stdenv = rocmClangStdenv; 426 - buildDocs = false; # No documentation to build 427 - buildMan = false; # No man pages to build 428 - targetName = "libclc"; 429 - targetDir = targetName; 430 - extraBuildInputs = [ spirv ]; 431 - 432 - # `spirv-mesa3d` isn't compiling with LLVM 15.0.0, it does with LLVM 14.0.0 433 - # Try removing the `spirv-mesa3d` and `clspv` patches next update 434 - # `clspv` tests fail, unresolved calls 435 - extraPostPatch = '' 436 - substituteInPlace CMakeLists.txt \ 437 - --replace "find_program( LLVM_CLANG clang PATHS \''${LLVM_BINDIR} NO_DEFAULT_PATH )" \ 438 - "find_program( LLVM_CLANG clang PATHS \"${clang}/bin\" NO_DEFAULT_PATH )" \ 439 - --replace "find_program( LLVM_SPIRV llvm-spirv PATHS \''${LLVM_BINDIR} NO_DEFAULT_PATH )" \ 440 - "find_program( LLVM_SPIRV llvm-spirv PATHS \"${spirv}/bin\" NO_DEFAULT_PATH )" \ 441 - --replace " spirv-mesa3d-" "" \ 442 - --replace " spirv64-mesa3d-" "" \ 443 - --replace "NOT \''${t} MATCHES" \ 444 - "NOT \''${ARCH} STREQUAL \"clspv\" AND NOT \''${ARCH} STREQUAL \"clspv64\" AND NOT \''${t} MATCHES" 445 - ''; 446 - 447 - checkTargets = [ ]; 448 - }; 449 - 450 - lldb = callPackage ./llvm.nix rec { 451 - stdenv = rocmClangStdenv; 452 - buildTests = false; # ld.lld: error: unable to find library -lllvm_gtest_main 453 - targetName = "lldb"; 454 - targetDir = targetName; 455 - extraNativeBuildInputs = [ python3Packages.sphinx-automodapi ]; 456 - 457 - extraBuildInputs = [ 458 - xz 459 - swig 460 - lua5_3 461 - gtest 462 - ]; 463 - 464 - extraCMakeFlags = [ 465 - "-DLLVM_EXTERNAL_LIT=${lit}/bin/.lit-wrapped" 466 - "-DLLDB_INCLUDE_TESTS=ON" 467 - "-DLLDB_INCLUDE_UNITTESTS=ON" 468 - ]; 469 - }; 470 - 471 - mlir = callPackage ./llvm.nix rec { 472 - stdenv = rocmClangStdenv; 473 - buildDocs = false; # No decent way to hack this to work 474 - buildMan = false; # No man pages to build 475 - targetName = "mlir"; 476 - targetDir = targetName; 477 - extraNativeBuildInputs = [ hip ]; 478 - 479 - extraBuildInputs = [ 480 - rocm-comgr 481 - vulkan-headers 482 - vulkan-loader 483 - glslang 484 - shaderc 485 - ]; 486 - 487 - extraCMakeFlags = [ 488 - "-DCMAKE_POLICY_DEFAULT_CMP0116=NEW" 489 - "-DMLIR_INCLUDE_DOCS=ON" 490 - "-DMLIR_INCLUDE_TESTS=ON" 491 - "-DMLIR_ENABLE_ROCM_RUNNER=ON" 492 - "-DMLIR_ENABLE_SPIRV_CPU_RUNNER=ON" 493 - "-DMLIR_ENABLE_VULKAN_RUNNER=ON" 494 - "-DROCM_TEST_CHIPSET=gfx000" # CPU runner 495 - ]; 496 - 497 - extraPostPatch = '' 498 - chmod +w ../llvm 499 - mkdir -p ../llvm/build/bin 500 - ln -s ${lit}/bin/lit ../llvm/build/bin/llvm-lit 501 - 502 - substituteInPlace test/CMakeLists.txt \ 503 - --replace "FileCheck count not" "" \ 504 - --replace "list(APPEND MLIR_TEST_DEPENDS mlir_rocm_runtime)" "" 505 - 506 - substituteInPlace lib/ExecutionEngine/CMakeLists.txt \ 507 - --replace "return()" "" 508 - 509 - # Remove problematic tests 510 - rm test/CAPI/execution_engine.c 511 - rm test/Target/LLVMIR/llvmir-intrinsics.mlir 512 - rm test/Target/LLVMIR/llvmir.mlir 513 - rm test/Target/LLVMIR/openmp-llvm.mlir 514 - rm test/mlir-cpu-runner/*.mlir 515 - rm test/mlir-vulkan-runner/*.mlir 516 - ''; 517 - 518 - extraPostInstall = '' 519 - mkdir -p $out/bin 520 - mv bin/mlir-tblgen $out/bin 521 - ''; 522 - 523 - checkTargets = [ "check-${targetName}" ]; 524 - }; 525 - 526 - polly = callPackage ./llvm.nix rec { 527 - stdenv = rocmClangStdenv; 528 - targetName = "polly"; 529 - targetDir = targetName; 530 - checkTargets = [ "check-${targetName}" ]; 531 - }; 532 - 533 - flang = callPackage ./llvm.nix rec { 534 - stdenv = rocmClangStdenv; 535 - buildTests = false; # `Executable "flang1" doesn't exist!` 536 - targetName = "flang"; 537 - targetDir = targetName; 538 - extraNativeBuildInputs = [ python3Packages.sphinx-markdown-tables ]; 539 - extraBuildInputs = [ mlir ]; 540 - 541 - extraCMakeFlags = [ 542 - "-DCMAKE_POLICY_DEFAULT_CMP0116=NEW" 543 - "-DCLANG_DIR=${clang-unwrapped}/lib/cmake/clang" 544 - "-DFLANG_INCLUDE_TESTS=OFF" 545 - "-DMLIR_TABLEGEN_EXE=${mlir}/bin/mlir-tblgen" 546 - ]; 547 - 548 - extraPostPatch = '' 549 - substituteInPlace test/CMakeLists.txt \ 550 - --replace "FileCheck" "" \ 551 - --replace "count" "" \ 552 - --replace "not" "" 553 - 554 - substituteInPlace docs/CMakeLists.txt \ 555 - --replace "CLANG_TABLEGEN_EXE clang-tblgen" "CLANG_TABLEGEN_EXE ${clang-unwrapped}/bin/clang-tblgen" 556 - ''; 557 - }; 558 - 559 - openmp = callPackage ./llvm.nix rec { 560 - stdenv = rocmClangStdenv; 561 - buildTests = false; # Too many failures, most pass 562 - targetName = "openmp"; 563 - targetDir = targetName; 564 - extraPatches = [ ./0000-fix-openmp.patch ]; 565 - extraNativeBuildInputs = [ perl ]; 566 - 567 - extraBuildInputs = [ 568 - rocm-device-libs 569 - rocm-runtime 570 - elfutils 571 - ]; 572 - 573 - extraCMakeFlags = [ 574 - "-DCMAKE_MODULE_PATH=/build/source/llvm/cmake/modules" # For docs 575 - "-DCLANG_TOOL=${clang}/bin/clang" 576 - "-DCLANG_OFFLOAD_BUNDLER_TOOL=${clang-unwrapped}/bin/clang-offload-bundler" 577 - "-DOPENMP_LLVM_TOOLS_DIR=${llvm}/bin" 578 - "-DOPENMP_LLVM_LIT_EXECUTABLE=${lit}/bin/.lit-wrapped" 579 - "-DDEVICELIBS_ROOT=${rocm-device-libs.src}" 580 - ]; 581 - 582 - extraPostPatch = '' 583 - # We can't build this target at the moment 584 - substituteInPlace libomptarget/DeviceRTL/CMakeLists.txt \ 585 - --replace "gfx1010" "" 586 - ''; 587 - 588 - checkTargets = [ "check-${targetName}" ]; 589 - extraLicenses = [ lib.licenses.mit ]; 590 - }; 591 - 592 - # Runtimes 593 - pstl = callPackage ./llvm.nix rec { 594 - stdenv = rocmClangStdenv; 595 - buildDocs = false; # No documentation to build 596 - buildMan = false; # No man pages to build 597 - buildTests = false; # Too many errors 598 - targetName = "pstl"; 599 - targetDir = "runtimes"; 600 - targetRuntimes = [ targetName ]; 601 - checkTargets = [ "check-${targetName}" ]; 602 - }; 603 - }
+9 -14
pkgs/development/compilers/llvm/rocm/llvm.nix pkgs/development/rocm-modules/5/llvm/base.nix
··· 24 24 , targetDir ? "llvm" 25 25 , targetProjects ? [ ] 26 26 , targetRuntimes ? [ ] 27 - # "NATIVE" resolves into x86 or aarch64 depending on stdenv 28 - , llvmTargetsToBuild ? [ "NATIVE" ] 27 + , llvmTargetsToBuild ? [ "NATIVE" ] # "NATIVE" resolves into x86 or aarch64 depending on stdenv 29 28 , extraPatches ? [ ] 30 29 , extraNativeBuildInputs ? [ ] 31 30 , extraBuildInputs ? [ ] ··· 39 38 ) 40 39 )] 41 40 , extraPostInstall ? "" 41 + , hardeningDisable ? [ ] 42 42 , requiredSystemFeatures ? [ ] 43 43 , extraLicenses ? [ ] 44 44 , isBroken ? false ··· 53 53 llvmTargetsToBuild' = [ "AMDGPU" ] ++ builtins.map inferNativeTarget llvmTargetsToBuild; 54 54 in stdenv.mkDerivation (finalAttrs: { 55 55 pname = "rocm-llvm-${targetName}"; 56 - version = "5.4.4"; 56 + version = "5.7.0"; 57 57 58 58 outputs = [ 59 59 "out" ··· 70 70 owner = "RadeonOpenCompute"; 71 71 repo = "llvm-project"; 72 72 rev = "rocm-${finalAttrs.version}"; 73 - hash = "sha256-BDvC6QFDFtahA9hmJDLiM6K4mrO3j9E9rEXm7KulcuA="; 73 + hash = "sha256-oJIXALwxo130jl8b6yCFw+a2kMBlny5/0ubiqF6MOWY="; 74 74 }; 75 75 76 76 nativeBuildInputs = [ ··· 108 108 "-DLLVM_ENABLE_PROJECTS=${lib.concatStringsSep ";" targetProjects}" 109 109 ] ++ lib.optionals ((finalAttrs.passthru.isLLVM || targetDir == "runtimes") && targetRuntimes != [ ]) [ 110 110 "-DLLVM_ENABLE_RUNTIMES=${lib.concatStringsSep ";" targetRuntimes}" 111 - ] ++ lib.optionals (finalAttrs.passthru.isLLVM || finalAttrs.passthru.isClang) [ 112 - "-DLLVM_ENABLE_RTTI=ON" 113 - "-DLLVM_ENABLE_EH=ON" 111 + ] ++ lib.optionals finalAttrs.passthru.isLLVM [ 112 + "-DLLVM_INSTALL_UTILS=ON" 113 + "-DLLVM_INSTALL_GTEST=ON" 114 114 ] ++ lib.optionals (buildDocs || buildMan) [ 115 115 "-DLLVM_INCLUDE_DOCS=ON" 116 116 "-DLLVM_BUILD_DOCS=ON" 117 117 # "-DLLVM_ENABLE_DOXYGEN=ON" Way too slow, only uses one core 118 118 "-DLLVM_ENABLE_SPHINX=ON" 119 - "-DLLVM_ENABLE_OCAMLDOC=OFF" 120 119 "-DSPHINX_OUTPUT_HTML=ON" 121 120 "-DSPHINX_OUTPUT_MAN=ON" 122 121 "-DSPHINX_WARNINGS_AS_ERRORS=OFF" 123 122 ] ++ lib.optionals buildTests [ 124 123 "-DLLVM_INCLUDE_TESTS=ON" 125 124 "-DLLVM_BUILD_TESTS=ON" 126 - ] ++ lib.optionals (buildTests && !finalAttrs.passthru.isLLVM) [ 127 125 "-DLLVM_EXTERNAL_LIT=${lit}/bin/.lit-wrapped" 128 126 ] ++ extraCMakeFlags; 129 127 ··· 141 139 doCheck = buildTests; 142 140 checkTarget = lib.concatStringsSep " " checkTargets; 143 141 144 - postInstall = lib.optionalString finalAttrs.passthru.isLLVM '' 145 - # `lit` expects these for some test suites 146 - mv bin/{FileCheck,not,count,yaml2obj,obj2yaml} $out/bin 147 - '' + lib.optionalString buildMan '' 142 + postInstall = lib.optionalString buildMan '' 148 143 mkdir -p $info 149 144 '' + extraPostInstall; 150 145 ··· 159 154 }; 160 155 }; 161 156 162 - inherit requiredSystemFeatures; 157 + inherit hardeningDisable requiredSystemFeatures; 163 158 164 159 meta = with lib; { 165 160 description = "ROCm fork of the LLVM compiler infrastructure";
+4 -6
pkgs/development/compilers/opensycl/default.nix
··· 2 2 , fetchFromGitHub 3 3 , llvmPackages_15 4 4 , lld_15 5 - , rocm-device-libs 6 5 , python3 7 - , rocm-runtime 8 6 , cmake 9 7 , boost 10 8 , libxml2 11 9 , libffi 12 10 , makeWrapper 13 - , hip 11 + , rocmPackages 14 12 , rocmSupport ? false 15 13 }: 16 14 let ··· 40 38 llvmPackages_15.libclang.dev 41 39 llvmPackages_15.llvm 42 40 ] ++ lib.optionals rocmSupport [ 43 - hip 44 - rocm-runtime 41 + rocmPackages.clr 42 + rocmPackages.rocm-runtime 45 43 ]; 46 44 47 45 # opensycl makes use of clangs internal headers. Its cmake does not successfully discover them automatically on nixos, so we supply the path manually ··· 55 53 --add-flags "-L${llvmPackages_15.openmp}/lib" \ 56 54 --add-flags "-I${llvmPackages_15.openmp.dev}/include" \ 57 55 '' + lib.optionalString rocmSupport '' 58 - --add-flags "--rocm-device-lib-path=${rocm-device-libs}/amdgcn/bitcode" 56 + --add-flags "--rocm-device-lib-path=${rocmPackages.rocm-device-libs}/amdgcn/bitcode" 59 57 ''; 60 58 61 59 meta = with lib; {
+7 -3
pkgs/development/compilers/spirv-llvm-translator/default.nix
··· 13 13 llvmMajor = lib.versions.major llvm.version; 14 14 isROCm = lib.hasPrefix "rocm" llvm.pname; 15 15 16 - # ROCm will always be at the latest version 16 + # ROCm, if actively updated will always be at the latest version 17 17 branch = 18 - if llvmMajor == "16" then rec { 18 + if llvmMajor == "17" || isROCm then rec { 19 + version = "17.0.0"; 20 + rev = "v${version}"; 21 + hash = "sha256-Rzm5Py9IPFtS9G7kME+uSwZ/0gPGW6MlL35ZWk4LfHM="; 22 + } else if llvmMajor == "16" then rec { 19 23 version = "16.0.0"; 20 24 rev = "v${version}"; 21 25 hash = "sha256-EUabcYqSjXshbPmcs1DRLvCSL1nd9rEdpqELBrItCW8="; 22 - } else if llvmMajor == "15" || isROCm then rec { 26 + } else if llvmMajor == "15" then rec { 23 27 version = "15.0.0"; 24 28 rev = "v${version}"; 25 29 hash = "sha256-OsDohXRxovtEXaWiRGp8gJ0dXmoALyO+ZimeSO8aPVI=";
+1 -1
pkgs/development/libraries/clang-ocl/default.nix pkgs/development/rocm-modules/5/clang-ocl/default.nix
··· 9 9 10 10 stdenv.mkDerivation (finalAttrs: { 11 11 pname = "clang-ocl"; 12 - version = "5.4.2"; 12 + version = "5.7.0"; 13 13 14 14 src = fetchFromGitHub { 15 15 owner = "RadeonOpenCompute";
+13 -11
pkgs/development/libraries/composable_kernel/default.nix pkgs/development/rocm-modules/5/composable_kernel/default.nix
··· 1 1 { lib 2 2 , stdenv 3 3 , fetchFromGitHub 4 - , unstableGitUpdater 4 + , rocmUpdateScript 5 5 , cmake 6 6 , rocm-cmake 7 - , hip 7 + , clr 8 8 , openmp 9 9 , clang-tools-extra 10 10 , gtest ··· 15 15 16 16 stdenv.mkDerivation (finalAttrs: { 17 17 pname = "composable_kernel"; 18 - version = "unstable-2023-01-16"; 18 + version = "5.7.0"; 19 19 20 20 outputs = [ 21 21 "out" ··· 25 25 "example" 26 26 ]; 27 27 28 - # ROCm 5.6 should release composable_kernel as stable with a tag in the future 29 28 src = fetchFromGitHub { 30 29 owner = "ROCmSoftwarePlatform"; 31 30 repo = "composable_kernel"; 32 - rev = "80e05267417f948e4f7e63c0fe807106d9a0c0ef"; 33 - hash = "sha256-+c0E2UtlG/abweLwCWWjNHDO5ZvSIVKwwwettT9mqR4="; 31 + rev = "rocm-${finalAttrs.version}"; 32 + hash = "sha256-Z9X+S2SijGJ8bhr9ghkkWicBUzLzs9fxPpqZxX6BBM4="; 34 33 }; 35 34 36 35 nativeBuildInputs = [ 37 36 cmake 38 37 rocm-cmake 39 - hip 38 + clr 40 39 clang-tools-extra 41 40 ]; 42 41 43 - buildInputs = [ 44 - openmp 45 - ]; 42 + buildInputs = [ openmp ]; 46 43 47 44 cmakeFlags = [ 48 45 "-DCMAKE_C_COMPILER=hipcc" ··· 71 68 mv $out/bin/example_* $example/bin 72 69 ''; 73 70 74 - passthru.updateScript = unstableGitUpdater { }; 71 + passthru.updateScript = rocmUpdateScript { 72 + name = finalAttrs.pname; 73 + owner = finalAttrs.src.owner; 74 + repo = finalAttrs.src.repo; 75 + }; 75 76 76 77 # Times out otherwise 77 78 requiredSystemFeatures = [ "big-parallel" ]; ··· 82 83 license = with licenses; [ mit ]; 83 84 maintainers = teams.rocm.members; 84 85 platforms = platforms.linux; 86 + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 85 87 }; 86 88 })
+53
pkgs/development/libraries/frugally-deep/default.nix
··· 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , gitUpdater 5 + , cmake 6 + , functionalplus 7 + , eigen 8 + , nlohmann_json 9 + , doctest 10 + , python3Packages 11 + , buildTests ? false # Needs tensorflow 12 + }: 13 + 14 + stdenv.mkDerivation (finalAttrs: { 15 + pname = "frugally-deep"; 16 + version = "0.15.24-p0"; 17 + 18 + src = fetchFromGitHub { 19 + owner = "Dobiasd"; 20 + repo = "frugally-deep"; 21 + rev = "v${finalAttrs.version}"; 22 + hash = "sha256-yg2SMsYOOSOgsdwIH1bU3iPM45z6c7WeIrgOddt3um4="; 23 + }; 24 + 25 + nativeBuildInputs = [ 26 + cmake 27 + ] ++ lib.optionals buildTests [ 28 + python3Packages.python 29 + python3Packages.numpy 30 + ]; 31 + 32 + buildInputs = lib.optionals buildTests [ 33 + doctest 34 + python3Packages.tensorflow 35 + ]; 36 + 37 + propagatedBuildInputs = [ 38 + functionalplus 39 + eigen 40 + nlohmann_json 41 + ]; 42 + 43 + cmakeFlags = lib.optionals buildTests [ "-DFDEEP_BUILD_UNITTEST=ON" ]; 44 + passthru.updateScript = gitUpdater; 45 + 46 + meta = with lib; { 47 + description = "Header-only library for using Keras (TensorFlow) models in C++"; 48 + homepage = "https://github.com/Dobiasd/frugally-deep"; 49 + license = with licenses; [ mit ]; 50 + maintainers = with maintainers; [ Madouura ]; 51 + platforms = platforms.linux; 52 + }; 53 + })
+5 -6
pkgs/development/libraries/hipblas/default.nix pkgs/development/rocm-modules/5/hipblas/default.nix
··· 4 4 , rocmUpdateScript 5 5 , cmake 6 6 , rocm-cmake 7 - , hip 7 + , clr 8 8 , gfortran 9 9 , rocblas 10 10 , rocsolver ··· 18 18 # Can also use cuBLAS 19 19 stdenv.mkDerivation (finalAttrs: { 20 20 pname = "hipblas"; 21 - version = "5.4.3"; 21 + version = "5.7.0"; 22 22 23 23 outputs = [ 24 24 "out" ··· 34 34 owner = "ROCmSoftwarePlatform"; 35 35 repo = "hipBLAS"; 36 36 rev = "rocm-${finalAttrs.version}"; 37 - hash = "sha256-mSZCq8UaiffMzWVflW1nAX6CQZ1DqwWJaSIzKslZSEk="; 37 + hash = "sha256-abaEZN82dsoEC5gIF3/6epRDVz5ItUo6CkZsybu/G+g="; 38 38 }; 39 39 40 40 nativeBuildInputs = [ 41 41 cmake 42 42 rocm-cmake 43 - hip 43 + clr 44 44 gfortran 45 45 ]; 46 46 ··· 94 94 license = with licenses; [ mit ]; 95 95 maintainers = teams.rocm.members; 96 96 platforms = platforms.linux; 97 - # Fixed in develop branch by using C++17 and related refactor 98 - broken = versions.minor finalAttrs.version != versions.minor hip.version || buildTests || buildBenchmarks || buildSamples; 97 + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 99 98 }; 100 99 })
+9 -6
pkgs/development/libraries/hipcub/default.nix pkgs/development/rocm-modules/5/hipcub/default.nix
··· 5 5 , cmake 6 6 , rocm-cmake 7 7 , rocprim 8 - , hip 8 + , clr 9 9 , gtest 10 10 , gbenchmark 11 11 , buildTests ? false 12 12 , buildBenchmarks ? false 13 + , gpuTargets ? [ ] 13 14 }: 14 15 15 16 # CUB can also be used as a backend instead of rocPRIM. 16 17 stdenv.mkDerivation (finalAttrs: { 17 18 pname = "hipcub"; 18 - version = "5.4.4"; 19 + version = "5.7.0"; 19 20 20 21 outputs = [ 21 22 "out" ··· 29 30 owner = "ROCmSoftwarePlatform"; 30 31 repo = "hipCUB"; 31 32 rev = "rocm-${finalAttrs.version}"; 32 - hash = "sha256-reFxSOYQOf9QcoZzaLt4D1yKGQoDxpt/3rwiHgP1DCo="; 33 + hash = "sha256-ygBEA3NuCQ13QrSzGqyWXkx8Dy9WhR3u4syzapRTkFU="; 33 34 }; 34 35 35 36 nativeBuildInputs = [ 36 37 cmake 37 38 rocm-cmake 38 - hip 39 + clr 39 40 ]; 40 41 41 42 buildInputs = [ ··· 48 49 49 50 cmakeFlags = [ 50 51 "-DCMAKE_CXX_COMPILER=hipcc" 51 - "-DHIP_ROOT_DIR=${hip}" 52 + "-DHIP_ROOT_DIR=${clr}" 52 53 # Manually define CMAKE_INSTALL_<DIR> 53 54 # See: https://github.com/NixOS/nixpkgs/pull/197838 54 55 "-DCMAKE_INSTALL_BINDIR=bin" 55 56 "-DCMAKE_INSTALL_LIBDIR=lib" 56 57 "-DCMAKE_INSTALL_INCLUDEDIR=include" 58 + ] ++ lib.optionals (gpuTargets != [ ]) [ 59 + "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" 57 60 ] ++ lib.optionals buildTests [ 58 61 "-DBUILD_TEST=ON" 59 62 ] ++ lib.optionals buildBenchmarks [ ··· 82 85 license = with licenses; [ bsd3 ]; 83 86 maintainers = teams.rocm.members; 84 87 platforms = platforms.linux; 85 - broken = versions.minor finalAttrs.version != versions.minor hip.version; 88 + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 86 89 }; 87 90 })
+11 -8
pkgs/development/libraries/hipfft/default.nix pkgs/development/rocm-modules/5/hipfft/default.nix
··· 4 4 , rocmUpdateScript 5 5 , cmake 6 6 , rocm-cmake 7 - , hip 7 + , clr 8 8 , git 9 9 , rocfft 10 10 , gtest ··· 15 15 , buildTests ? false 16 16 , buildBenchmarks ? false 17 17 , buildSamples ? false 18 + , gpuTargets ? [ ] 18 19 }: 19 20 20 21 # Can also use cuFFT 21 22 stdenv.mkDerivation (finalAttrs: { 22 23 pname = "hipfft"; 23 - version = "5.4.3"; 24 + version = "5.7.0"; 24 25 25 26 outputs = [ 26 27 "out" ··· 36 37 owner = "ROCmSoftwarePlatform"; 37 38 repo = "hipFFT"; 38 39 rev = "rocm-${finalAttrs.version}"; 39 - hash = "sha256-yDtm9J0wqH6zo4HcgQbqhvwbzbOiJPQ48gJ2gC8PvjA="; 40 + hash = "sha256-fuYRKdlTrRMwxr3cgMeT3YniPzs4nuvF8YCzr3LLPFM="; 40 41 fetchSubmodules = true; 41 42 }; 42 43 43 44 nativeBuildInputs = [ 44 - hip 45 + clr 45 46 git 46 47 cmake 47 48 rocm-cmake ··· 60 61 cmakeFlags = [ 61 62 "-DCMAKE_C_COMPILER=hipcc" 62 63 "-DCMAKE_CXX_COMPILER=hipcc" 63 - "-DCMAKE_MODULE_PATH=${hip}/lib/cmake/hip" 64 - "-DHIP_ROOT_DIR=${hip}" 65 - "-DHIP_PATH=${hip}" 64 + "-DCMAKE_MODULE_PATH=${clr}/lib/cmake/hip" 65 + "-DHIP_ROOT_DIR=${clr}" 66 + "-DHIP_PATH=${clr}" 66 67 # Manually define CMAKE_INSTALL_<DIR> 67 68 # See: https://github.com/NixOS/nixpkgs/pull/197838 68 69 "-DCMAKE_INSTALL_BINDIR=bin" 69 70 "-DCMAKE_INSTALL_LIBDIR=lib" 70 71 "-DCMAKE_INSTALL_INCLUDEDIR=include" 72 + ] ++ lib.optionals (gpuTargets != [ ]) [ 73 + "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" 71 74 ] ++ lib.optionals buildTests [ 72 75 "-DBUILD_CLIENTS_TESTS=ON" 73 76 ] ++ lib.optionals buildBenchmarks [ ··· 102 105 license = with licenses; [ mit ]; 103 106 maintainers = teams.rocm.members; 104 107 platforms = platforms.linux; 105 - broken = versions.minor finalAttrs.version != versions.minor hip.version; 108 + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 106 109 }; 107 110 })
+2 -2
pkgs/development/libraries/hipfort/default.nix pkgs/development/rocm-modules/5/hipfort/default.nix
··· 9 9 10 10 stdenv.mkDerivation (finalAttrs: { 11 11 pname = "hipfort"; 12 - version = "5.6.0"; 12 + version = "5.7.0"; 13 13 14 14 src = fetchFromGitHub { 15 15 owner = "ROCmSoftwarePlatform"; 16 16 repo = "hipfort"; 17 17 rev = "rocm-${finalAttrs.version}"; 18 - hash = "sha256-x1pF9md7RIcobE/4UxHxOaURbljFZGOashW1KM0lmo0="; 18 + hash = "sha256-DRjUWhdinDKP7CZgq2SmU3lGmmodCuXvco9aEeMLSZ4="; 19 19 }; 20 20 21 21 nativeBuildInputs = [
+5 -5
pkgs/development/libraries/hipsolver/default.nix pkgs/development/rocm-modules/5/hipsolver/default.nix
··· 4 4 , rocmUpdateScript 5 5 , cmake 6 6 , rocm-cmake 7 - , hip 7 + , clr 8 8 , gfortran 9 9 , rocblas 10 10 , rocsolver ··· 18 18 # Can also use cuSOLVER 19 19 stdenv.mkDerivation (finalAttrs: { 20 20 pname = "hipsolver"; 21 - version = "5.4.4"; 21 + version = "5.7.0"; 22 22 23 23 outputs = [ 24 24 "out" ··· 34 34 owner = "ROCmSoftwarePlatform"; 35 35 repo = "hipSOLVER"; 36 36 rev = "rocm-${finalAttrs.version}"; 37 - hash = "sha256-p9hgKqRALLItv/HTpVlTsu+m9wlwCBYPYnJcm8StIao="; 37 + hash = "sha256-I9Xjkilo+baeM1CRXjLAbj/vrg8r5/E2yEImhHGSyf8="; 38 38 }; 39 39 40 40 nativeBuildInputs = [ 41 41 cmake 42 42 rocm-cmake 43 - hip 43 + clr 44 44 gfortran 45 45 ]; 46 46 ··· 95 95 license = with licenses; [ mit ]; 96 96 maintainers = teams.rocm.members; 97 97 platforms = platforms.linux; 98 - broken = versions.minor finalAttrs.version != versions.minor hip.version; 98 + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 99 99 }; 100 100 })
+10 -10
pkgs/development/libraries/hipsparse/default.nix pkgs/development/rocm-modules/5/hipsparse/default.nix
··· 5 5 , cmake 6 6 , rocm-cmake 7 7 , rocsparse 8 - , hip 8 + , clr 9 9 , gfortran 10 10 , git 11 11 , gtest 12 12 , openmp 13 13 , buildTests ? false 14 14 , buildSamples ? false 15 + , gpuTargets ? [ ] 15 16 }: 16 17 17 18 # This can also use cuSPARSE as a backend instead of rocSPARSE 18 19 stdenv.mkDerivation (finalAttrs: { 19 20 pname = "hipsparse"; 20 - version = "5.4.4"; 21 + version = "5.7.0"; 21 22 22 23 outputs = [ 23 24 "out" ··· 31 32 owner = "ROCmSoftwarePlatform"; 32 33 repo = "hipSPARSE"; 33 34 rev = "rocm-${finalAttrs.version}"; 34 - hash = "sha256-JWjmMvqIm4in1aPq2UgYmL0eWjrrRBiU6vH3FnCZZ40="; 35 + hash = "sha256-txigaOoZMI/v+EQLgGlj2O0IHfE7EpgjL0cyv49nKzo="; 35 36 }; 36 37 37 38 nativeBuildInputs = [ 38 39 cmake 39 40 rocm-cmake 40 - hip 41 + clr 41 42 gfortran 42 43 ]; 43 44 ··· 59 60 "-DCMAKE_INSTALL_BINDIR=bin" 60 61 "-DCMAKE_INSTALL_LIBDIR=lib" 61 62 "-DCMAKE_INSTALL_INCLUDEDIR=include" 63 + ] ++ lib.optionals (gpuTargets != [ ]) [ 64 + "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" 62 65 ] ++ lib.optionals buildTests [ 63 66 "-DBUILD_CLIENTS_TESTS=ON" 64 67 ]; 65 68 66 69 # We have to manually generate the matrices 67 70 # CMAKE_MATRICES_DIR seems to be reset in clients/tests/CMakeLists.txt 68 - postPatch = '' 69 - substituteInPlace clients/common/utility.cpp \ 70 - --replace "#ifdef __cpp_lib_filesystem" " #if true" 71 - '' + lib.optionalString buildTests '' 71 + postPatch = lib.optionalString buildTests '' 72 72 mkdir -p matrices 73 73 74 74 ln -s ${rocsparse.passthru.matrices.matrix-01}/*.mtx matrices ··· 116 116 mkdir -p $sample/bin 117 117 mv clients/staging/example_* $sample/bin 118 118 patchelf --set-rpath $out/lib:${lib.makeLibraryPath ( 119 - finalAttrs.buildInputs ++ [ hip gfortran.cc ])} $sample/bin/example_* 119 + finalAttrs.buildInputs ++ [ clr gfortran.cc ])} $sample/bin/example_* 120 120 ''; 121 121 122 122 passthru.updateScript = rocmUpdateScript { ··· 131 131 license = with licenses; [ mit ]; 132 132 maintainers = teams.rocm.members; 133 133 platforms = platforms.linux; 134 - broken = versions.minor finalAttrs.version != versions.minor hip.version; 134 + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 135 135 }; 136 136 })
+23 -11
pkgs/development/libraries/migraphx/default.nix pkgs/development/rocm-modules/5/migraphx/default.nix
··· 5 5 , pkg-config 6 6 , cmake 7 7 , rocm-cmake 8 - , hip 8 + , clr 9 9 , clang-tools-extra 10 10 , openmp 11 11 , rocblas 12 12 , rocmlir 13 + , composable_kernel 13 14 , miopengemm 14 15 , miopen 15 16 , protobuf ··· 19 20 , sqlite 20 21 , oneDNN_2 21 22 , blaze 23 + , cppcheck 24 + , rocm-device-libs 22 25 , texlive 23 26 , doxygen 24 27 , sphinx ··· 46 49 }; 47 50 in stdenv.mkDerivation (finalAttrs: { 48 51 pname = "migraphx"; 49 - version = "5.4.3"; 52 + version = "5.7.0"; 50 53 51 54 outputs = [ 52 55 "out" ··· 60 63 owner = "ROCmSoftwarePlatform"; 61 64 repo = "AMDMIGraphX"; 62 65 rev = "rocm-${finalAttrs.version}"; 63 - hash = "sha256-UDhm+j9qs4Rk81C1PE4kkacytfY2StYbfsCOtFL+p6s="; 66 + hash = "sha256-7yL7Zn5I8GUPIAgB7tVLZI7OEHLv0E4FcLVx9xMfsNY="; 64 67 }; 65 68 66 69 nativeBuildInputs = [ 67 70 pkg-config 68 71 cmake 69 72 rocm-cmake 70 - hip 73 + clr 71 74 clang-tools-extra 72 75 python3Packages.python 73 76 ] ++ lib.optionals buildDocs [ ··· 84 87 openmp 85 88 rocblas 86 89 rocmlir 90 + composable_kernel 87 91 miopengemm 88 92 miopen 89 93 protobuf ··· 93 97 sqlite 94 98 oneDNN_2 95 99 blaze 100 + cppcheck 96 101 python3Packages.pybind11 97 102 python3Packages.onnx 98 103 ]; 99 104 100 105 cmakeFlags = [ 101 - "-DCMAKE_POLICY_DEFAULT_CMP0079=NEW" 102 - # "-DCMAKE_C_COMPILER=hipcc" 103 - # "-DCMAKE_CXX_COMPILER=hipcc" 104 - "-DMIGRAPHX_ENABLE_GPU=OFF" # GPU compilation is broken, don't know why 106 + "-DMIGRAPHX_ENABLE_GPU=ON" 105 107 "-DMIGRAPHX_ENABLE_CPU=ON" 106 108 "-DMIGRAPHX_ENABLE_FPGA=ON" 107 - "-DMIGRAPHX_ENABLE_MLIR=ON" 109 + "-DMIGRAPHX_ENABLE_MLIR=OFF" # LLVM or rocMLIR mismatch? 108 110 # Manually define CMAKE_INSTALL_<DIR> 109 111 # See: https://github.com/NixOS/nixpkgs/pull/197838 110 112 "-DCMAKE_INSTALL_BINDIR=bin" ··· 113 115 ]; 114 116 115 117 postPatch = '' 118 + # We need to not use hipcc and define the CXXFLAGS manually due to `undefined hidden symbol: tensorflow:: ...` 119 + export CXXFLAGS+="--rocm-path=${clr} --rocm-device-lib-path=${rocm-device-libs}/amdgcn/bitcode" 116 120 patchShebangs tools 117 121 122 + # `error: '__clang_hip_runtime_wrapper.h' file not found [clang-diagnostic-error]` 123 + substituteInPlace CMakeLists.txt \ 124 + --replace "set(MIGRAPHX_TIDY_ERRORS ALL)" "" 125 + 126 + # JIT library was removed from composable_kernel... 127 + # https://github.com/ROCmSoftwarePlatform/composable_kernel/issues/782 118 128 substituteInPlace src/targets/gpu/CMakeLists.txt \ 119 - --replace "CMAKE_CXX_COMPILER MATCHES \".*clang\\\+\\\+\$\"" "TRUE" 129 + --replace " COMPONENTS jit_library" "" \ 130 + --replace " composable_kernel::jit_library" "" \ 131 + --replace "if(WIN32)" "if(TRUE)" 120 132 '' + lib.optionalString (!buildDocs) '' 121 133 substituteInPlace CMakeLists.txt \ 122 134 --replace "add_subdirectory(doc)" "" ··· 155 167 license = with licenses; [ mit ]; 156 168 maintainers = teams.rocm.members; 157 169 platforms = platforms.linux; 158 - broken = versions.minor finalAttrs.version != versions.minor hip.version; 170 + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 159 171 }; 160 172 })
-190
pkgs/development/libraries/miopen/default.nix
··· 1 - { lib 2 - , stdenv 3 - , fetchFromGitHub 4 - , fetchurl 5 - , rocmUpdateScript 6 - , pkg-config 7 - , cmake 8 - , rocm-cmake 9 - , rocblas 10 - , rocmlir 11 - , hip 12 - , clang-tools-extra 13 - , clang-ocl 14 - , llvm 15 - , miopengemm 16 - , composable_kernel 17 - , half 18 - , boost 19 - , sqlite 20 - , bzip2 21 - , nlohmann_json 22 - , texlive 23 - , doxygen 24 - , sphinx 25 - , zlib 26 - , gtest 27 - , rocm-comgr 28 - , python3Packages 29 - , buildDocs ? true 30 - , buildTests ? false 31 - , fetchKDBs ? true 32 - , useOpenCL ? false 33 - }: 34 - 35 - let 36 - latex = lib.optionalAttrs buildDocs texlive.combine { 37 - inherit (texlive) scheme-small 38 - latexmk 39 - tex-gyre 40 - fncychap 41 - wrapfig 42 - capt-of 43 - framed 44 - needspace 45 - tabulary 46 - varwidth 47 - titlesec; 48 - }; 49 - 50 - kdbs = lib.optionalAttrs fetchKDBs import ./deps.nix { 51 - inherit fetchurl; 52 - mirror = "https://repo.radeon.com/rocm/miopen-kernel/rel-5.0"; 53 - }; 54 - in stdenv.mkDerivation (finalAttrs: { 55 - pname = "miopen"; 56 - version = "5.4.2"; 57 - 58 - outputs = [ 59 - "out" 60 - ] ++ lib.optionals buildDocs [ 61 - "doc" 62 - ] ++ lib.optionals buildTests [ 63 - "test" 64 - ]; 65 - 66 - src = fetchFromGitHub { 67 - owner = "ROCmSoftwarePlatform"; 68 - repo = "MIOpen"; 69 - rev = "rocm-${finalAttrs.version}"; 70 - hash = "sha256-GfXPCXiVJVve3d8sQCQcFLb/vEnKkVEn7xYUhHkEEVI="; 71 - }; 72 - 73 - nativeBuildInputs = [ 74 - pkg-config 75 - cmake 76 - rocm-cmake 77 - hip 78 - clang-tools-extra 79 - ]; 80 - 81 - buildInputs = [ 82 - llvm 83 - rocblas 84 - rocmlir 85 - clang-ocl 86 - miopengemm 87 - composable_kernel 88 - half 89 - boost 90 - sqlite 91 - bzip2 92 - nlohmann_json 93 - ] ++ lib.optionals buildDocs [ 94 - latex 95 - doxygen 96 - sphinx 97 - python3Packages.sphinx-rtd-theme 98 - python3Packages.breathe 99 - python3Packages.myst-parser 100 - ] ++ lib.optionals buildTests [ 101 - zlib 102 - ]; 103 - 104 - cmakeFlags = [ 105 - "-DMIOPEN_USE_MIOPENGEMM=ON" 106 - # Manually define CMAKE_INSTALL_<DIR> 107 - # See: https://github.com/NixOS/nixpkgs/pull/197838 108 - "-DCMAKE_INSTALL_BINDIR=bin" 109 - "-DCMAKE_INSTALL_LIBDIR=lib" 110 - "-DCMAKE_INSTALL_INCLUDEDIR=include" 111 - ] ++ lib.optionals (!useOpenCL) [ 112 - "-DCMAKE_C_COMPILER=hipcc" 113 - "-DCMAKE_CXX_COMPILER=hipcc" 114 - "-DMIOPEN_BACKEND=HIP" 115 - ] ++ lib.optionals useOpenCL [ 116 - "-DMIOPEN_BACKEND=OpenCL" 117 - ] ++ lib.optionals buildTests [ 118 - "-DBUILD_TESTS=ON" 119 - "-DMIOPEN_TEST_ALL=ON" 120 - "-DMIOPEN_TEST_GFX900=ON" 121 - "-DMIOPEN_TEST_GFX906=ON" 122 - "-DMIOPEN_TEST_GFX908=ON" 123 - "-DMIOPEN_TEST_GFX90A=ON" 124 - "-DMIOPEN_TEST_GFX103X=ON" 125 - "-DGOOGLETEST_DIR=${gtest.src}" # Custom linker names 126 - ]; 127 - 128 - postPatch = '' 129 - substituteInPlace CMakeLists.txt \ 130 - --replace "enable_testing()" "" \ 131 - --replace "MIOPEN_HIP_COMPILER MATCHES \".*clang\\\\+\\\\+$\"" "true" \ 132 - --replace "set(MIOPEN_TIDY_ERRORS ALL)" "" # error: missing required key 'key' 133 - '' + lib.optionalString buildTests '' 134 - substituteInPlace test/gtest/CMakeLists.txt \ 135 - --replace "enable_testing()" "" 136 - '' + lib.optionalString (!buildTests) '' 137 - substituteInPlace CMakeLists.txt \ 138 - --replace "add_subdirectory(test)" "" 139 - '' + lib.optionalString fetchKDBs '' 140 - ln -sf ${kdbs.gfx1030_36} src/kernels/gfx1030_36.kdb 141 - ln -sf ${kdbs.gfx900_56} src/kernels/gfx900_56.kdb 142 - ln -sf ${kdbs.gfx900_64} src/kernels/gfx900_64.kdb 143 - ln -sf ${kdbs.gfx906_60} src/kernels/gfx906_60.kdb 144 - ln -sf ${kdbs.gfx906_64} src/kernels/gfx906_64.kdb 145 - ln -sf ${kdbs.gfx90878} src/kernels/gfx90878.kdb 146 - ln -sf ${kdbs.gfx90a68} src/kernels/gfx90a68.kdb 147 - ln -sf ${kdbs.gfx90a6e} src/kernels/gfx90a6e.kdb 148 - ''; 149 - 150 - # Unfortunately, it seems like we have to call make on these manually 151 - postBuild = lib.optionalString buildDocs '' 152 - export HOME=$(mktemp -d) 153 - make -j$NIX_BUILD_CORES doc 154 - '' + lib.optionalString buildTests '' 155 - make -j$NIX_BUILD_CORES check 156 - ''; 157 - 158 - postInstall = '' 159 - rm $out/bin/install_precompiled_kernels.sh 160 - '' + lib.optionalString buildDocs '' 161 - mv ../doc/html $out/share/doc/miopen-${if useOpenCL then "opencl" else "hip"} 162 - mv ../doc/pdf/miopen.pdf $out/share/doc/miopen-${if useOpenCL then "opencl" else "hip"} 163 - '' + lib.optionalString buildTests '' 164 - mkdir -p $test/bin 165 - mv bin/test_* $test/bin 166 - patchelf --set-rpath $out/lib:${lib.makeLibraryPath (finalAttrs.buildInputs ++ 167 - [ hip rocm-comgr ])} $test/bin/* 168 - '' + lib.optionalString fetchKDBs '' 169 - # Apparently gfx1030_40 wasn't generated so the developers suggest just renaming gfx1030_36 to it 170 - # Should be fixed in the next miopen kernel generation batch 171 - ln -s ${kdbs.gfx1030_36} $out/share/miopen/db/gfx1030_40.kdb 172 - ''; 173 - 174 - requiredSystemFeatures = [ "big-parallel" ]; 175 - 176 - passthru.updateScript = rocmUpdateScript { 177 - name = finalAttrs.pname; 178 - owner = finalAttrs.src.owner; 179 - repo = finalAttrs.src.repo; 180 - }; 181 - 182 - meta = with lib; { 183 - description = "Machine intelligence library for ROCm"; 184 - homepage = "https://github.com/ROCmSoftwarePlatform/MIOpen"; 185 - license = with licenses; [ mit ]; 186 - maintainers = teams.rocm.members; 187 - platforms = platforms.linux; 188 - broken = versions.minor finalAttrs.version != versions.minor hip.version; 189 - }; 190 - })
-45
pkgs/development/libraries/miopen/deps.nix
··· 1 - { fetchurl 2 - , mirror 3 - }: 4 - 5 - { 6 - gfx1030_36 = fetchurl { 7 - sha256 = "sha256-zEXDLkRWAHS15LDA5IRyqG5rO7HHPBiVgPlQ8JjSqNc="; 8 - url = "${mirror}/gfx1030_36.kdb"; 9 - }; 10 - 11 - gfx900_56 = fetchurl { 12 - sha256 = "sha256-ZTqUPhVKcQzjO6bxykvZMJk1VZh31dRVs+XqcxEtmeI="; 13 - url = "${mirror}/gfx900_56.kdb"; 14 - }; 15 - 16 - gfx900_64 = fetchurl { 17 - sha256 = "sha256-ZTqUPhVKcQzjO6bxykvZMJk1VZh31dRVs+XqcxEtmeI="; 18 - url = "${mirror}/gfx900_64.kdb"; 19 - }; 20 - 21 - gfx906_60 = fetchurl { 22 - sha256 = "sha256-U6pDo8ICfs6fVIEqRziWeE5/4Vzvu41JkcRVn3ou1e4="; 23 - url = "${mirror}/gfx906_60.kdb"; 24 - }; 25 - 26 - gfx906_64 = fetchurl { 27 - sha256 = "sha256-U6pDo8ICfs6fVIEqRziWeE5/4Vzvu41JkcRVn3ou1e4="; 28 - url = "${mirror}/gfx906_64.kdb"; 29 - }; 30 - 31 - gfx90878 = fetchurl { 32 - sha256 = "sha256-r7DRhNH+jHUXAu64b9vWsZzGD4w5oSHnxH0l2RN0qlQ="; 33 - url = "${mirror}/gfx90878.kdb"; 34 - }; 35 - 36 - gfx90a68 = fetchurl { 37 - sha256 = "sha256-NT//zIPTbzsPJyaVycxwU6BcMTzGc/d+Z4Ab9FImDko="; 38 - url = "${mirror}/gfx90a68.kdb"; 39 - }; 40 - 41 - gfx90a6e = fetchurl { 42 - sha256 = "sha256-ENZHbf+/MGYgSTpALKh2meuZPNhH5bG+WrW/jzvGpBs="; 43 - url = "${mirror}/gfx90a6e.kdb"; 44 - }; 45 - }
+13 -10
pkgs/development/libraries/miopengemm/default.nix pkgs/development/rocm-modules/5/miopengemm/default.nix
··· 4 4 , rocmUpdateScript 5 5 , cmake 6 6 , rocm-cmake 7 - , rocm-opencl-runtime 7 + , clr 8 + , clblast 8 9 , texlive 9 10 , doxygen 10 11 , sphinx ··· 31 32 }; 32 33 in stdenv.mkDerivation (finalAttrs: { 33 34 pname = "miopengemm"; 34 - version = "5.4.3"; 35 + version = "5.5.0"; 35 36 36 37 outputs = [ 37 38 "out" ··· 53 54 nativeBuildInputs = [ 54 55 cmake 55 56 rocm-cmake 57 + clr 56 58 ]; 57 59 58 - buildInputs = [ 59 - rocm-opencl-runtime 60 - ] ++ lib.optionals buildDocs [ 60 + buildInputs = lib.optionals buildDocs [ 61 61 latex 62 62 doxygen 63 63 sphinx ··· 65 65 python3Packages.breathe 66 66 ] ++ lib.optionals buildTests [ 67 67 openblas 68 + ] ++ lib.optionals buildBenchmarks [ 69 + clblast 70 + python3Packages.openai-triton 68 71 ]; 69 72 70 73 cmakeFlags = [ ··· 77 80 "-DOPENBLAS=ON" 78 81 ] ++ lib.optionals buildBenchmarks [ 79 82 "-DAPI_BENCH_MIOGEMM=ON" 80 - # Needs https://github.com/CNugteren/CLBlast 81 - # "-DAPI_BENCH_CLBLAST=ON" 82 - # Needs https://github.com/openai/triton 83 - # "-DAPI_BENCH_ISAAC=ON" 83 + "-DAPI_BENCH_CLBLAST=ON" 84 + "-DAPI_BENCH_ISAAC=ON" 84 85 ]; 85 86 86 87 # Unfortunately, it seems like we have to call make on these manually ··· 118 119 license = with licenses; [ mit ]; 119 120 maintainers = teams.rocm.members; 120 121 platforms = platforms.linux; 121 - broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 122 + # They are not making tags or releases, this may break other derivations in the future 123 + # Use version major instead of minor, 6.0 will HOPEFULLY have a release or tag 124 + broken = versions.major finalAttrs.version != versions.major stdenv.cc.version; 122 125 }; 123 126 })
+17 -9
pkgs/development/libraries/rccl/default.nix pkgs/development/rocm-modules/5/rccl/default.nix
··· 5 5 , cmake 6 6 , rocm-cmake 7 7 , rocm-smi 8 - , hip 8 + , clr 9 + , perl 10 + , hipify 9 11 , gtest 10 12 , chrpath 11 13 , buildTests ? false 14 + , gpuTargets ? [ ] 12 15 }: 13 16 14 17 stdenv.mkDerivation (finalAttrs: { 15 18 pname = "rccl"; 16 - version = "5.4.3"; 19 + version = "5.7.0"; 17 20 18 21 outputs = [ 19 22 "out" ··· 25 28 owner = "ROCmSoftwarePlatform"; 26 29 repo = "rccl"; 27 30 rev = "rocm-${finalAttrs.version}"; 28 - hash = "sha256-hQTzaiPMo5FAVScmxV0iNhy80uJ1xvx/kzlbfwROOs4="; 31 + hash = "sha256-Abrwmsjnkx9JVTrARP/BM965g+R10lY+XPwthy/SG0k="; 29 32 }; 30 33 31 34 nativeBuildInputs = [ 32 35 cmake 33 36 rocm-cmake 34 - hip 37 + clr 38 + perl 39 + hipify 35 40 ]; 36 41 37 42 buildInputs = [ ··· 42 47 ]; 43 48 44 49 cmakeFlags = [ 45 - "-DCMAKE_C_COMPILER=hipcc" 46 50 "-DCMAKE_CXX_COMPILER=hipcc" 51 + "-DBUILD_BFD=OFF" # Can't get it to detect bfd.h 47 52 # Manually define CMAKE_INSTALL_<DIR> 48 53 # See: https://github.com/NixOS/nixpkgs/pull/197838 49 54 "-DCMAKE_INSTALL_BINDIR=bin" 50 55 "-DCMAKE_INSTALL_LIBDIR=lib" 51 56 "-DCMAKE_INSTALL_INCLUDEDIR=include" 57 + ] ++ lib.optionals (gpuTargets != [ ]) [ 58 + "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" 52 59 ] ++ lib.optionals buildTests [ 53 60 "-DBUILD_TESTS=ON" 54 61 ]; 55 62 56 - # Replace the manually set parallel jobs to NIX_BUILD_CORES 57 63 postPatch = '' 64 + patchShebangs src tools 65 + 66 + # Really strange behavior, `#!/usr/bin/env perl` should work... 58 67 substituteInPlace CMakeLists.txt \ 59 - --replace "8 P" "$NIX_BUILD_CORES P" \ 60 - --replace "8)" "$NIX_BUILD_CORES)" 68 + --replace "\''$ \''${hipify-perl_executable}" "${perl}/bin/perl ${hipify}/bin/hipify-perl" 61 69 ''; 62 70 63 71 postInstall = lib.optionalString buildTests '' ··· 78 86 license = with licenses; [ bsd2 bsd3 ]; 79 87 maintainers = teams.rocm.members; 80 88 platforms = platforms.linux; 81 - broken = versions.minor finalAttrs.version != versions.minor hip.version; 89 + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 82 90 }; 83 91 })
+8 -8
pkgs/development/libraries/rocalution/default.nix pkgs/development/rocm-modules/5/rocalution/default.nix
··· 8 8 , rocsparse 9 9 , rocprim 10 10 , rocrand 11 - , hip 11 + , clr 12 12 , git 13 13 , openmp 14 14 , openmpi ··· 21 21 22 22 stdenv.mkDerivation (finalAttrs: { 23 23 pname = "rocalution"; 24 - version = "5.4.3"; 24 + version = "5.7.0"; 25 25 26 26 outputs = [ 27 27 "out" ··· 37 37 owner = "ROCmSoftwarePlatform"; 38 38 repo = "rocALUTION"; 39 39 rev = "rocm-${finalAttrs.version}"; 40 - hash = "sha256-jovhodhNa7tr1bSqpZCKI/9xF7Ie96JB+giqAEfis2k="; 40 + hash = "sha256-+UGpFuZsC4+kmo8LWZWC2YoFJSdTukjN47e1YqW5Zu4="; 41 41 }; 42 42 43 43 nativeBuildInputs = [ 44 44 cmake 45 45 rocm-cmake 46 - hip 46 + clr 47 47 git 48 48 ]; 49 49 ··· 60 60 61 61 cmakeFlags = [ 62 62 "-DCMAKE_CXX_COMPILER=hipcc" 63 - "-DROCM_PATH=${hip}" 64 - "-DHIP_ROOT_DIR=${hip}" 63 + "-DROCM_PATH=${clr}" 64 + "-DHIP_ROOT_DIR=${clr}" 65 65 "-DSUPPORT_HIP=ON" 66 66 "-DSUPPORT_OMP=ON" 67 67 "-DSUPPORT_MPI=ON" ··· 92 92 rm $sample/bin/rocalution-bench || true 93 93 94 94 patchelf --set-rpath \ 95 - $out/lib:${lib.makeLibraryPath (finalAttrs.buildInputs ++ [ hip ])} \ 95 + $out/lib:${lib.makeLibraryPath (finalAttrs.buildInputs ++ [ clr ])} \ 96 96 $sample/bin/* 97 97 '' + lib.optionalString (buildTests || buildBenchmarks) '' 98 98 rmdir $out/bin ··· 110 110 license = with licenses; [ mit ]; 111 111 maintainers = teams.rocm.members; 112 112 platforms = platforms.linux; 113 - broken = versions.minor finalAttrs.version != versions.minor hip.version; 113 + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 114 114 }; 115 115 })
-139
pkgs/development/libraries/rocblas/default.nix
··· 1 - { lib 2 - , stdenv 3 - , fetchFromGitHub 4 - , rocmUpdateScript 5 - , cmake 6 - , rocm-cmake 7 - , hip 8 - , python3 9 - , tensile 10 - , msgpack 11 - , libxml2 12 - , gtest 13 - , gfortran 14 - , openmp 15 - , amd-blis 16 - , python3Packages 17 - , buildTensile ? true 18 - , buildTests ? false 19 - , buildBenchmarks ? false 20 - , tensileLogic ? "asm_full" 21 - , tensileCOVersion ? "V3" 22 - , tensileSepArch ? true 23 - , tensileLazyLib ? true 24 - , tensileLibFormat ? "msgpack" 25 - , gpuTargets ? [ "all" ] 26 - }: 27 - 28 - stdenv.mkDerivation (finalAttrs: { 29 - pname = "rocblas"; 30 - version = "5.4.3"; 31 - 32 - outputs = [ 33 - "out" 34 - ] ++ lib.optionals buildTests [ 35 - "test" 36 - ] ++ lib.optionals buildBenchmarks [ 37 - "benchmark" 38 - ]; 39 - 40 - src = fetchFromGitHub { 41 - owner = "ROCmSoftwarePlatform"; 42 - repo = "rocBLAS"; 43 - rev = "rocm-${finalAttrs.version}"; 44 - hash = "sha256-XhYpzBXviMnUdbF6lZi9g0LARKpzWLtDxJxLI3MuHiM="; 45 - }; 46 - 47 - nativeBuildInputs = [ 48 - cmake 49 - rocm-cmake 50 - hip 51 - ]; 52 - 53 - buildInputs = [ 54 - python3 55 - ] ++ lib.optionals buildTensile [ 56 - msgpack 57 - libxml2 58 - python3Packages.msgpack 59 - ] ++ lib.optionals buildTests [ 60 - gtest 61 - ] ++ lib.optionals (buildTests || buildBenchmarks) [ 62 - gfortran 63 - openmp 64 - amd-blis 65 - ] ++ lib.optionals (buildTensile || buildTests || buildBenchmarks) [ 66 - python3Packages.pyyaml 67 - ]; 68 - 69 - cmakeFlags = [ 70 - "-DCMAKE_C_COMPILER=hipcc" 71 - "-DCMAKE_CXX_COMPILER=hipcc" 72 - "-Dpython=python3" 73 - "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" 74 - "-DBUILD_WITH_TENSILE=${if buildTensile then "ON" else "OFF"}" 75 - # Manually define CMAKE_INSTALL_<DIR> 76 - # See: https://github.com/NixOS/nixpkgs/pull/197838 77 - "-DCMAKE_INSTALL_BINDIR=bin" 78 - "-DCMAKE_INSTALL_LIBDIR=lib" 79 - "-DCMAKE_INSTALL_INCLUDEDIR=include" 80 - ] ++ lib.optionals buildTensile [ 81 - "-DVIRTUALENV_HOME_DIR=/build/source/tensile" 82 - "-DTensile_TEST_LOCAL_PATH=/build/source/tensile" 83 - "-DTensile_ROOT=/build/source/tensile/lib/python${python3.pythonVersion}/site-packages/Tensile" 84 - "-DTensile_LOGIC=${tensileLogic}" 85 - "-DTensile_CODE_OBJECT_VERSION=${tensileCOVersion}" 86 - "-DTensile_SEPARATE_ARCHITECTURES=${if tensileSepArch then "ON" else "OFF"}" 87 - "-DTensile_LAZY_LIBRARY_LOADING=${if tensileLazyLib then "ON" else "OFF"}" 88 - "-DTensile_LIBRARY_FORMAT=${tensileLibFormat}" 89 - ] ++ lib.optionals buildTests [ 90 - "-DBUILD_CLIENTS_TESTS=ON" 91 - ] ++ lib.optionals buildBenchmarks [ 92 - "-DBUILD_CLIENTS_BENCHMARKS=ON" 93 - ] ++ lib.optionals (buildTests || buildBenchmarks) [ 94 - "-DCMAKE_CXX_FLAGS=-I${amd-blis}/include/blis" 95 - ]; 96 - 97 - # Tensile REALLY wants to write to the nix directory if we include it normally 98 - postPatch = lib.optionalString buildTensile '' 99 - cp -a ${tensile} tensile 100 - chmod +w -R tensile 101 - 102 - # Rewrap Tensile 103 - substituteInPlace tensile/bin/{.t*,.T*,*} \ 104 - --replace "${tensile}" "/build/source/tensile" 105 - 106 - substituteInPlace CMakeLists.txt \ 107 - --replace "include(virtualenv)" "" \ 108 - --replace "virtualenv_install(\''${Tensile_TEST_LOCAL_PATH})" "" 109 - ''; 110 - 111 - postInstall = lib.optionalString buildTests '' 112 - mkdir -p $test/bin 113 - cp -a $out/bin/* $test/bin 114 - rm $test/bin/*-bench || true 115 - '' + lib.optionalString buildBenchmarks '' 116 - mkdir -p $benchmark/bin 117 - cp -a $out/bin/* $benchmark/bin 118 - rm $benchmark/bin/*-test || true 119 - '' + lib.optionalString (buildTests || buildBenchmarks ) '' 120 - rm -rf $out/bin 121 - ''; 122 - 123 - passthru.updateScript = rocmUpdateScript { 124 - name = finalAttrs.pname; 125 - owner = finalAttrs.src.owner; 126 - repo = finalAttrs.src.repo; 127 - }; 128 - 129 - requiredSystemFeatures = [ "big-parallel" ]; 130 - 131 - meta = with lib; { 132 - description = "BLAS implementation for ROCm platform"; 133 - homepage = "https://github.com/ROCmSoftwarePlatform/rocBLAS"; 134 - license = with licenses; [ mit ]; 135 - maintainers = teams.rocm.members; 136 - platforms = platforms.linux; 137 - broken = versions.minor finalAttrs.version != versions.minor hip.version; 138 - }; 139 - })
-64
pkgs/development/libraries/rocclr/default.nix
··· 1 - { lib 2 - , stdenv 3 - , fetchFromGitHub 4 - , fetchpatch 5 - , rocmUpdateScript 6 - , rocm-comgr 7 - }: 8 - 9 - stdenv.mkDerivation (finalAttrs: { 10 - pname = "rocclr"; 11 - version = "5.4.4"; 12 - 13 - src = fetchFromGitHub { 14 - owner = "ROCm-Developer-Tools"; 15 - repo = "ROCclr"; 16 - rev = "rocm-${finalAttrs.version}"; 17 - hash = "sha256-DbN7kL8oyaPeYQB19Q96L3wX66v62TMSWl0Yor7Q4kE="; 18 - }; 19 - 20 - patches = [ 21 - # Enable support for gfx8 again 22 - # See the upstream issue: https://github.com/RadeonOpenCompute/ROCm/issues/1659 23 - # And the arch patch: https://github.com/rocm-arch/rocm-arch/pull/742 24 - (fetchpatch { 25 - url = "https://raw.githubusercontent.com/John-Gee/rocm-arch/d6812d308fee3caf2b6bb01b4d19fe03a6a0e3bd/rocm-opencl-runtime/enable-gfx800.patch"; 26 - hash = "sha256-59jFDIIsTTZcNns9RyMVWPRUggn/bSlAGrky4quu8B4="; 27 - }) 28 - ]; 29 - 30 - postPatch = '' 31 - substituteInPlace device/comgrctx.cpp \ 32 - --replace "libamd_comgr.so" "${rocm-comgr}/lib/libamd_comgr.so" 33 - ''; 34 - 35 - dontConfigure = true; 36 - dontBuild = true; 37 - 38 - installPhase = '' 39 - runHook preInstall 40 - 41 - mkdir -p $out 42 - cp -a * $out/ 43 - 44 - runHook postInstall 45 - ''; 46 - 47 - passthru.updateScript = rocmUpdateScript { 48 - name = finalAttrs.pname; 49 - owner = finalAttrs.src.owner; 50 - repo = finalAttrs.src.repo; 51 - }; 52 - 53 - meta = with lib; { 54 - description = "Source package of the Radeon Open Compute common language runtime"; 55 - homepage = "https://github.com/ROCm-Developer-Tools/ROCclr"; 56 - license = licenses.mit; 57 - maintainers = with maintainers; [ lovesegfault ] ++ teams.rocm.members; 58 - # rocclr seems to have some AArch64 ifdefs, but does not seem 59 - # to be supported yet by the build infrastructure. Recheck in 60 - # the future. 61 - platforms = [ "x86_64-linux" ]; 62 - broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 63 - }; 64 - })
+13 -2
pkgs/development/libraries/rocdbgapi/default.nix pkgs/development/rocm-modules/5/rocdbgapi/default.nix
··· 7 7 , git 8 8 , rocm-comgr 9 9 , rocm-runtime 10 + , hwdata 10 11 , texlive 11 12 , doxygen 12 13 , graphviz ··· 37 38 }; 38 39 in stdenv.mkDerivation (finalAttrs: { 39 40 pname = "rocdbgapi"; 40 - version = "5.4.2"; 41 + version = "5.7.0"; 41 42 42 43 outputs = [ 43 44 "out" ··· 49 50 owner = "ROCm-Developer-Tools"; 50 51 repo = "ROCdbgapi"; 51 52 rev = "rocm-${finalAttrs.version}"; 52 - hash = "sha256-KoFa6JzoEPT5/ns9X/hMfu8bOh29HD9n2qGJ3gzhiBA="; 53 + hash = "sha256-qMXvgcS61lgcylz62ErYq8fhpYIR31skQEeKUryuP1w="; 53 54 }; 54 55 55 56 nativeBuildInputs = [ ··· 65 66 buildInputs = [ 66 67 rocm-comgr 67 68 rocm-runtime 69 + hwdata 70 + ]; 71 + 72 + cmakeFlags = [ 73 + "-DPCI_IDS_PATH=${hwdata}/share/hwdata" 74 + # Manually define CMAKE_INSTALL_<DIR> 75 + # See: https://github.com/NixOS/nixpkgs/pull/197838 76 + "-DCMAKE_INSTALL_BINDIR=bin" 77 + "-DCMAKE_INSTALL_LIBDIR=lib" 78 + "-DCMAKE_INSTALL_INCLUDEDIR=include" 68 79 ]; 69 80 70 81 # Unfortunately, it seems like we have to call make on this manually
-243
pkgs/development/libraries/rocfft/default.nix
··· 1 - { rocfft 2 - , lib 3 - , stdenv 4 - , fetchFromGitHub 5 - , rocmUpdateScript 6 - , cmake 7 - , hip 8 - , python3 9 - , rocm-cmake 10 - , sqlite 11 - , boost 12 - , fftw 13 - , fftwFloat 14 - , gtest 15 - , openmp 16 - , rocrand 17 - # NOTE: Update the default GPU targets on every update 18 - , gpuTargets ? [ 19 - "gfx803" 20 - "gfx900" 21 - "gfx906" 22 - "gfx908" 23 - "gfx90a" 24 - "gfx1030" 25 - "gfx1100" 26 - "gfx1102" 27 - ] 28 - }: 29 - 30 - let 31 - # To avoid output limit exceeded errors in hydra, we build kernel 32 - # device libs and the kernel RTC cache database in separate derivations 33 - kernelDeviceLibs = map 34 - (target: 35 - (rocfft.overrideAttrs (prevAttrs: { 36 - pname = "rocfft-device-${target}"; 37 - 38 - patches = prevAttrs.patches ++ [ 39 - # Add back install rule for device library 40 - # This workaround is needed because rocm_install_targets 41 - # doesn't support an EXCLUDE_FROM_ALL option 42 - ./device-install.patch 43 - ]; 44 - 45 - buildFlags = [ "rocfft-device-${target}" ]; 46 - 47 - installPhase = '' 48 - runHook preInstall 49 - cmake --install . --component device 50 - runHook postInstall 51 - ''; 52 - 53 - requiredSystemFeatures = [ "big-parallel" ]; 54 - })).override { 55 - gpuTargets = [ target ]; 56 - } 57 - ) 58 - gpuTargets; 59 - 60 - # TODO: Figure out how to also split this by GPU target 61 - # 62 - # It'll be bit more complicated than what we're doing for the kernel 63 - # device libs, because the kernel cache needs to be compiled into 64 - # one sqlite database (whereas the device libs can be linked into 65 - # rocfft as separate libraries for each GPU target). 66 - # 67 - # It's not clear why this needs to even be a db in the first place. 68 - # It would simplify things A LOT if we could just store these 69 - # pre-compiled kernels as files (but that'd need a lot of patching). 70 - kernelRtcCache = rocfft.overrideAttrs (_: { 71 - pname = "rocfft-kernel-cache"; 72 - 73 - buildFlags = [ "rocfft_kernel_cache_target" ]; 74 - 75 - installPhase = '' 76 - runHook preInstall 77 - cmake --install . --component kernel_cache 78 - runHook postInstall 79 - ''; 80 - 81 - requiredSystemFeatures = [ "big-parallel" ]; 82 - }); 83 - in 84 - stdenv.mkDerivation (finalAttrs: { 85 - pname = "rocfft"; 86 - version = "5.4.3"; 87 - 88 - src = fetchFromGitHub { 89 - owner = "ROCmSoftwarePlatform"; 90 - repo = "rocFFT"; 91 - rev = "rocm-${finalAttrs.version}"; 92 - hash = "sha256-FsefE0B2hF5ZcHDB6TscwFeZ1NKFkWX7VDpEvvbDbOk="; 93 - }; 94 - 95 - patches = [ 96 - # Exclude kernel compilation & installation from "all" target, 97 - # and split device libraries by GPU target 98 - ./split-kernel-compilation.patch 99 - ]; 100 - 101 - nativeBuildInputs = [ 102 - cmake 103 - hip 104 - python3 105 - rocm-cmake 106 - ]; 107 - 108 - buildInputs = [ 109 - sqlite 110 - ] ++ lib.optionals (finalAttrs.pname == "rocfft") kernelDeviceLibs; 111 - 112 - cmakeFlags = [ 113 - "-DCMAKE_C_COMPILER=hipcc" 114 - "-DCMAKE_CXX_COMPILER=hipcc" 115 - "-DUSE_HIP_CLANG=ON" 116 - "-DSQLITE_USE_SYSTEM_PACKAGE=ON" 117 - # Manually define CMAKE_INSTALL_<DIR> 118 - # See: https://github.com/NixOS/nixpkgs/pull/197838 119 - "-DCMAKE_INSTALL_BINDIR=bin" 120 - "-DCMAKE_INSTALL_LIBDIR=lib" 121 - "-DCMAKE_INSTALL_INCLUDEDIR=include" 122 - "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" 123 - ]; 124 - 125 - postInstall = lib.optionalString (finalAttrs.pname == "rocfft") '' 126 - ln -s ${kernelRtcCache}/lib/rocfft_kernel_cache.db "$out/lib" 127 - ''; 128 - 129 - passthru = { 130 - test = stdenv.mkDerivation { 131 - pname = "${finalAttrs.pname}-test"; 132 - inherit (finalAttrs) version src; 133 - 134 - sourceRoot = "${finalAttrs.src.name}/clients/tests"; 135 - 136 - nativeBuildInputs = [ 137 - cmake 138 - hip 139 - rocm-cmake 140 - ]; 141 - 142 - buildInputs = [ 143 - boost 144 - fftw 145 - fftwFloat 146 - finalAttrs.finalPackage 147 - gtest 148 - openmp 149 - rocrand 150 - ]; 151 - 152 - cmakeFlags = [ 153 - "-DCMAKE_C_COMPILER=hipcc" 154 - "-DCMAKE_CXX_COMPILER=hipcc" 155 - ]; 156 - 157 - postInstall = '' 158 - rm -r "$out/lib/fftw" 159 - rmdir "$out/lib" 160 - ''; 161 - }; 162 - 163 - benchmark = stdenv.mkDerivation { 164 - pname = "${finalAttrs.pname}-benchmark"; 165 - inherit (finalAttrs) version src; 166 - 167 - sourceRoot = "${finalAttrs.src.name}/clients/rider"; 168 - 169 - nativeBuildInputs = [ 170 - cmake 171 - hip 172 - rocm-cmake 173 - ]; 174 - 175 - buildInputs = [ 176 - boost 177 - finalAttrs.finalPackage 178 - openmp 179 - (python3.withPackages (ps: with ps; [ 180 - pandas 181 - scipy 182 - ])) 183 - rocrand 184 - ]; 185 - 186 - cmakeFlags = [ 187 - "-DCMAKE_C_COMPILER=hipcc" 188 - "-DCMAKE_CXX_COMPILER=hipcc" 189 - ]; 190 - 191 - postInstall = '' 192 - cp -a ../../../scripts/perf "$out/bin" 193 - ''; 194 - }; 195 - 196 - samples = stdenv.mkDerivation { 197 - pname = "${finalAttrs.pname}-samples"; 198 - inherit (finalAttrs) version src; 199 - 200 - sourceRoot = "${finalAttrs.src.name}/clients/samples"; 201 - 202 - nativeBuildInputs = [ 203 - cmake 204 - hip 205 - rocm-cmake 206 - ]; 207 - 208 - buildInputs = [ 209 - boost 210 - finalAttrs.finalPackage 211 - openmp 212 - rocrand 213 - ]; 214 - 215 - cmakeFlags = [ 216 - "-DCMAKE_C_COMPILER=hipcc" 217 - "-DCMAKE_CXX_COMPILER=hipcc" 218 - ]; 219 - 220 - installPhase = '' 221 - runHook preInstall 222 - mkdir "$out" 223 - cp -a bin "$out" 224 - runHook postInstall 225 - ''; 226 - }; 227 - 228 - updateScript = rocmUpdateScript { 229 - name = finalAttrs.pname; 230 - owner = finalAttrs.src.owner; 231 - repo = finalAttrs.src.repo; 232 - }; 233 - }; 234 - 235 - meta = with lib; { 236 - description = "FFT implementation for ROCm"; 237 - homepage = "https://github.com/ROCmSoftwarePlatform/rocFFT"; 238 - license = with licenses; [ mit ]; 239 - maintainers = with maintainers; [ kira-bruneau ] ++ teams.rocm.members; 240 - platforms = platforms.linux; 241 - broken = versions.minor finalAttrs.version != versions.minor hip.version; 242 - }; 243 - })
-15
pkgs/development/libraries/rocfft/device-install.patch
··· 1 - diff --git a/library/src/device/CMakeLists.txt b/library/src/device/CMakeLists.txt 2 - index 73a8ec9..9bfd4b8 100644 3 - --- a/library/src/device/CMakeLists.txt 4 - +++ b/library/src/device/CMakeLists.txt 5 - @@ -255,4 +255,10 @@ foreach( sub ${AMDGPU_TARGETS} ) 6 - if( NOT BUILD_SHARED_LIBS ) 7 - set_target_properties( rocfft-device-${sub} PROPERTIES PREFIX "lib" ) 8 - endif( ) 9 - + 10 - + rocm_install_targets( 11 - + TARGETS 12 - + rocfft-device-${sub} 13 - + COMPONENT device 14 - + ) 15 - endforeach()
-124
pkgs/development/libraries/rocfft/split-kernel-compilation.patch
··· 1 - diff --git a/library/src/CMakeLists.txt b/library/src/CMakeLists.txt 2 - index 3a16304..606b711 100644 3 - --- a/library/src/CMakeLists.txt 4 - +++ b/library/src/CMakeLists.txt 5 - @@ -250,12 +250,12 @@ foreach( target 6 - 7 - endforeach() 8 - 9 - -add_executable( rocfft_aot_helper 10 - +add_executable( rocfft_aot_helper EXCLUDE_FROM_ALL 11 - rocfft_aot_helper.cpp 12 - rocfft_stub.cpp 13 - ) 14 - 15 - -add_executable( rocfft_config_search 16 - +add_executable( rocfft_config_search EXCLUDE_FROM_ALL 17 - rocfft_config_search.cpp 18 - rocfft_stub.cpp 19 - ) 20 - @@ -279,10 +279,10 @@ endif() 21 - 22 - target_link_libraries( rocfft PRIVATE ${ROCFFT_DEVICE_LINK_LIBS} ) 23 - 24 - -target_link_libraries( rocfft PRIVATE rocfft-device-0 ) 25 - -target_link_libraries( rocfft PRIVATE rocfft-device-1 ) 26 - -target_link_libraries( rocfft PRIVATE rocfft-device-2 ) 27 - -target_link_libraries( rocfft PRIVATE rocfft-device-3 ) 28 - +foreach( sub ${AMDGPU_TARGETS} ) 29 - + target_link_libraries( rocfft PRIVATE -lrocfft-device-${sub} ) 30 - +endforeach() 31 - + 32 - foreach( target rocfft rocfft_aot_helper rocfft_config_search ) 33 - # RTC uses dladdr to find the RTC helper program 34 - if( NOT WIN32 ) 35 - @@ -347,7 +347,7 @@ add_custom_command( 36 - DEPENDS rocfft_aot_helper rocfft_rtc_helper 37 - COMMENT "Compile kernels into shipped cache file" 38 - ) 39 - -add_custom_target( rocfft_kernel_cache_target ALL 40 - +add_custom_target( rocfft_kernel_cache_target 41 - DEPENDS rocfft_kernel_cache.db 42 - VERBATIM 43 - ) 44 - @@ -392,7 +392,8 @@ else() 45 - endif() 46 - rocm_install(FILES ${ROCFFT_KERNEL_CACHE_PATH} 47 - DESTINATION "${ROCFFT_KERNEL_CACHE_INSTALL_DIR}" 48 - - COMPONENT runtime 49 - + COMPONENT kernel_cache 50 - + EXCLUDE_FROM_ALL 51 - ) 52 - 53 - # PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ 54 - diff --git a/library/src/device/CMakeLists.txt b/library/src/device/CMakeLists.txt 55 - index 9f7b85f..73a8ec9 100644 56 - --- a/library/src/device/CMakeLists.txt 57 - +++ b/library/src/device/CMakeLists.txt 58 - @@ -170,11 +170,11 @@ list( SORT rocfft_device_source ) 59 - # functions callable by rocFFT and depends on amdhip64, and another 60 - # one usable by AOT RTC that contains no device code 61 - list( FILTER rocfft_device_source EXCLUDE REGEX function_pool.cpp ) 62 - -add_library( rocfft-function-pool OBJECT 63 - +add_library( rocfft-function-pool OBJECT EXCLUDE_FROM_ALL 64 - function_pool.cpp 65 - ) 66 - target_compile_definitions( rocfft-function-pool PRIVATE FUNCTION_POOL_STANDALONE_BODY= ) 67 - -add_library( rocfft-function-pool-standalone OBJECT 68 - +add_library( rocfft-function-pool-standalone OBJECT EXCLUDE_FROM_ALL 69 - function_pool.cpp 70 - ) 71 - target_compile_definitions( rocfft-function-pool-standalone PRIVATE FUNCTION_POOL_STANDALONE_BODY={} ) 72 - @@ -193,26 +193,15 @@ foreach( pool rocfft-function-pool rocfft-function-pool-standalone ) 73 - add_dependencies(${pool} gen_headers_target) 74 - endforeach() 75 - 76 - -list( LENGTH rocfft_device_source rocfft_device_source_len ) 77 - -math(EXPR split_len "${rocfft_device_source_len} / 4") 78 - -math(EXPR split_idx_2 "${rocfft_device_source_len} / 4 * 2") 79 - -math(EXPR split_idx_3 "${rocfft_device_source_len} / 4 * 3") 80 - - 81 - -list( SUBLIST rocfft_device_source 0 ${split_len} rocfft_device_source_0 ) 82 - -list( SUBLIST rocfft_device_source ${split_len} ${split_len} rocfft_device_source_1 ) 83 - -list( SUBLIST rocfft_device_source ${split_idx_2} ${split_len} rocfft_device_source_2 ) 84 - -list( SUBLIST rocfft_device_source ${split_idx_3} -1 rocfft_device_source_3 ) 85 - - 86 - -foreach( sub RANGE 3 ) 87 - - set( rocfft_device_source_var rocfft_device_source_${sub} ) 88 - +foreach( sub ${AMDGPU_TARGETS} ) 89 - if(NOT SINGLELIB) 90 - - add_library( rocfft-device-${sub} 91 - - ${${rocfft_device_source_var}} ) 92 - + add_library( rocfft-device-${sub} EXCLUDE_FROM_ALL 93 - + ${rocfft_device_source} ) 94 - else() 95 - # Compile the device lib as a static library, which is then linked 96 - # into librocfft.so Useful for testing purposes. 97 - - add_library( rocfft-device-${sub} STATIC 98 - - ${${rocfft_device_source_var}} ) 99 - + add_library( rocfft-device-${sub} STATIC EXCLUDE_FROM_ALL 100 - + ${rocfft_device_source} ) 101 - 102 - # if we're building singlelib, we don't want to export any of the 103 - # device library symbols to the main library 104 - @@ -241,9 +230,7 @@ foreach( sub RANGE 3 ) 105 - # Set AMD GPU architecture options 106 - 107 - # Enable compilation of desired architectures 108 - - foreach( target ${AMDGPU_TARGETS} ) 109 - - target_compile_options( rocfft-device-${sub} PRIVATE --offload-arch=${target} ) 110 - - endforeach( ) 111 - + target_compile_options( rocfft-device-${sub} PRIVATE --offload-arch=${sub} ) 112 - 113 - target_include_directories( rocfft-device-${sub} 114 - PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> 115 - @@ -268,9 +255,4 @@ foreach( sub RANGE 3 ) 116 - if( NOT BUILD_SHARED_LIBS ) 117 - set_target_properties( rocfft-device-${sub} PROPERTIES PREFIX "lib" ) 118 - endif( ) 119 - - 120 - - rocm_install_targets( 121 - - TARGETS 122 - - rocfft-device-${sub} 123 - - ) 124 - endforeach()
-365
pkgs/development/libraries/rocm-comgr/cmake.patch
··· 1 - diff --git a/CMakeLists.txt b/CMakeLists.txt 2 - index 62b857b..d21c7f4 100644 3 - --- a/CMakeLists.txt 4 - +++ b/CMakeLists.txt 5 - @@ -147,8 +147,8 @@ if (UNIX) 6 - list(APPEND AMD_COMGR_PUBLIC_LINKER_OPTIONS -pthread) 7 - if (NOT APPLE AND COMGR_BUILD_SHARED_LIBS) 8 - configure_file( 9 - - ${CMAKE_CURRENT_SOURCE_DIR}/src/exportmap.in 10 - - ${CMAKE_CURRENT_BINARY_DIR}/src/exportmap @ONLY) 11 - + src/exportmap.in 12 - + src/exportmap @ONLY) 13 - list(APPEND AMD_COMGR_PRIVATE_LINKER_OPTIONS 14 - "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/src/exportmap") 15 - # When building a shared library with -fsanitize=address we can't be 16 - @@ -175,10 +175,6 @@ endif() 17 - # the shared header. 18 - list(APPEND AMD_COMGR_PRIVATE_COMPILE_DEFINITIONS AMD_COMGR_EXPORT) 19 - 20 - -configure_file( 21 - - ${CMAKE_CURRENT_SOURCE_DIR}/include/amd_comgr.h.in 22 - - ${CMAKE_CURRENT_BINARY_DIR}/include/amd_comgr.h @ONLY) 23 - - 24 - include(bc2h) 25 - include(opencl_pch) 26 - include(DeviceLibs) 27 - @@ -212,10 +208,14 @@ target_include_directories(amd_comgr 28 - $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include> 29 - $<INSTALL_INTERFACE:include>) 30 - 31 - +configure_file( 32 - + include/amd_comgr.h.in 33 - + include/amd_comgr.h @ONLY) 34 - + 35 - set(AMD_COMGR_CONFIG_NAME amd_comgr-config.cmake) 36 - set(AMD_COMGR_TARGETS_NAME amd_comgr-targets.cmake) 37 - set(AMD_COMGR_VERSION_NAME amd_comgr-config-version.cmake) 38 - -set(AMD_COMGR_PACKAGE_PREFIX ${CMAKE_INSTALL_LIBDIR}/cmake/amd_comgr) 39 - +set(AMD_COMGR_PACKAGE_PREFIX cmake/amd_comgr) 40 - 41 - # Generate the build-tree package. 42 - set(AMD_COMGR_PREFIX_CODE) 43 - @@ -226,13 +226,13 @@ if (NOT COMGR_BUILD_SHARED_LIBS) 44 - endif() 45 - 46 - set(AMD_COMGR_TARGETS_PATH 47 - - "${CMAKE_CURRENT_BINARY_DIR}/${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_TARGETS_NAME}") 48 - + "${CMAKE_CURRENT_BINARY_DIR}/lib/${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_TARGETS_NAME}") 49 - set(AMD_COMGR_VERSION_PATH 50 - - "${CMAKE_CURRENT_BINARY_DIR}/${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_VERSION_NAME}") 51 - + "${CMAKE_CURRENT_BINARY_DIR}/lib/${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_VERSION_NAME}") 52 - export(TARGETS amd_comgr 53 - - FILE "${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_TARGETS_NAME}") 54 - + FILE "lib/${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_TARGETS_NAME}") 55 - configure_file("cmake/${AMD_COMGR_CONFIG_NAME}.in" 56 - - "${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_CONFIG_NAME}" 57 - + "lib/${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_CONFIG_NAME}" 58 - @ONLY) 59 - write_basic_package_version_file("${AMD_COMGR_VERSION_PATH}" 60 - VERSION "${amd_comgr_VERSION}" 61 - @@ -266,7 +266,7 @@ install(FILES 62 - set(AMD_COMGR_PREFIX_CODE " 63 - # Derive absolute install prefix from config file path. 64 - get_filename_component(AMD_COMGR_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)") 65 - -string(REGEX REPLACE "/" ";" count "${AMD_COMGR_PACKAGE_PREFIX}") 66 - +string(REGEX REPLACE "/" ";" count "${CMAKE_INSTALL_LIBDIR}/${AMD_COMGR_PACKAGE_PREFIX}") 67 - foreach(p ${count}) 68 - set(AMD_COMGR_PREFIX_CODE "${AMD_COMGR_PREFIX_CODE} 69 - get_filename_component(AMD_COMGR_PREFIX \"\${AMD_COMGR_PREFIX}\" PATH)") 70 - @@ -278,20 +278,20 @@ if (NOT COMGR_BUILD_SHARED_LIBS) 71 - string(APPEND AMD_COMGR_PREFIX_CODE "find_dependency(LLD REQUIRED)\n") 72 - endif() 73 - 74 - -set(AMD_COMGR_TARGETS_PATH "\${AMD_COMGR_PREFIX}/${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_TARGETS_NAME}") 75 - +set(AMD_COMGR_TARGETS_PATH "\${AMD_COMGR_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_TARGETS_NAME}") 76 - configure_file("cmake/${AMD_COMGR_CONFIG_NAME}.in" 77 - - "${CMAKE_CURRENT_BINARY_DIR}/${AMD_COMGR_CONFIG_NAME}.install" 78 - + "${AMD_COMGR_CONFIG_NAME}.install" 79 - @ONLY) 80 - install(FILES 81 - "${CMAKE_CURRENT_BINARY_DIR}/${AMD_COMGR_CONFIG_NAME}.install" 82 - - DESTINATION "${AMD_COMGR_PACKAGE_PREFIX}" 83 - + DESTINATION "${CMAKE_INSTALL_LIBDIR}/${AMD_COMGR_PACKAGE_PREFIX}" 84 - RENAME "${AMD_COMGR_CONFIG_NAME}") 85 - install(EXPORT amd_comgr_export 86 - - DESTINATION "${AMD_COMGR_PACKAGE_PREFIX}" 87 - + DESTINATION "${CMAKE_INSTALL_LIBDIR}/${AMD_COMGR_PACKAGE_PREFIX}" 88 - FILE "${AMD_COMGR_TARGETS_NAME}") 89 - install(FILES 90 - "${AMD_COMGR_VERSION_PATH}" 91 - - DESTINATION "${AMD_COMGR_PACKAGE_PREFIX}") 92 - + DESTINATION "${CMAKE_INSTALL_LIBDIR}/${AMD_COMGR_PACKAGE_PREFIX}") 93 - 94 - if(TARGET clangFrontendTool) 95 - set(CLANG_LIBS 96 - diff --git a/cmake/DeviceLibs.cmake b/cmake/DeviceLibs.cmake 97 - index 27e9546..dfe1b57 100644 98 - --- a/cmake/DeviceLibs.cmake 99 - +++ b/cmake/DeviceLibs.cmake 100 - @@ -1,8 +1,7 @@ 101 - set(INC_DIR ${CMAKE_CURRENT_BINARY_DIR}/include) 102 - 103 - set(GEN_LIBRARY_INC_FILE ${INC_DIR}/libraries.inc) 104 - - 105 - -file(WRITE ${GEN_LIBRARY_INC_FILE} "// Automatically generated file; DO NOT EDIT.\n") 106 - +set(GEN_LIBRARY_DEFS_INC_FILE ${INC_DIR}/libraries_defs.inc) 107 - 108 - # cmake does not provide a way to query targets produced by a project, 109 - # so we have to make one up. Ordinarily, individual library target 110 - @@ -23,6 +22,7 @@ if(NOT AMD_DEVICE_LIBS_TARGETS) 111 - message(FATAL_ERROR "Could not find list of device libraries") 112 - endif() 113 - 114 - +set(TARGETS_INCLUDES "") 115 - foreach(AMDGCN_LIB_TARGET ${AMD_DEVICE_LIBS_TARGETS}) 116 - set(header ${AMDGCN_LIB_TARGET}.inc) 117 - 118 - @@ -54,75 +54,52 @@ foreach(AMDGCN_LIB_TARGET ${AMD_DEVICE_LIBS_TARGETS}) 119 - add_custom_target(${AMDGCN_LIB_TARGET}_header DEPENDS ${INC_DIR}/${header}) 120 - add_dependencies(amd_comgr ${AMDGCN_LIB_TARGET}_header) 121 - 122 - - file(APPEND ${GEN_LIBRARY_INC_FILE} "#include \"${header}\"\n") 123 - + list(APPEND TARGETS_INCLUDES "#include \"${header}\"") 124 - +endforeach() 125 - + 126 - +list(JOIN TARGETS_INCLUDES "\n" TARGETS_INCLUDES) 127 - +file(GENERATE OUTPUT ${GEN_LIBRARY_INC_FILE} CONTENT "${TARGETS_INCLUDES}") 128 - + 129 - +foreach(OPENCL_VERSION 1.2 2.0) 130 - + string(REPLACE . _ OPENCL_UNDERSCORE_VERSION ${OPENCL_VERSION}) 131 - + add_custom_command(OUTPUT ${INC_DIR}/opencl${OPENCL_VERSION}-c.inc 132 - + COMMAND bc2h ${CMAKE_CURRENT_BINARY_DIR}/opencl${OPENCL_VERSION}-c.pch 133 - + ${INC_DIR}/opencl${OPENCL_VERSION}-c.inc 134 - + opencl${OPENCL_UNDERSCORE_VERSION}_c 135 - + DEPENDS bc2h ${CMAKE_CURRENT_BINARY_DIR}/opencl${OPENCL_VERSION}-c.pch 136 - + COMMENT "Generating opencl${OPENCL_VERSION}-c.inc" 137 - + ) 138 - + set_property(DIRECTORY APPEND PROPERTY 139 - + ADDITIONAL_MAKE_CLEAN_FILES ${INC_DIR}/opencl${OPENCL_VERSION}-c.inc) 140 - + add_custom_target(opencl${OPENCL_VERSION}-c.inc_target DEPENDS ${INC_DIR}/opencl${OPENCL_VERSION}-c.inc) 141 - + add_dependencies(amd_comgr opencl${OPENCL_VERSION}-c.inc_target) 142 - endforeach() 143 - 144 - -add_custom_command(OUTPUT ${INC_DIR}/opencl1.2-c.inc 145 - - COMMAND bc2h ${CMAKE_CURRENT_BINARY_DIR}/opencl1.2-c.pch 146 - - ${INC_DIR}/opencl1.2-c.inc 147 - - opencl1_2_c 148 - - DEPENDS bc2h ${CMAKE_CURRENT_BINARY_DIR}/opencl1.2-c.pch 149 - - COMMENT "Generating opencl1.2-c.inc" 150 - -) 151 - -set_property(DIRECTORY APPEND PROPERTY 152 - - ADDITIONAL_MAKE_CLEAN_FILES ${INC_DIR}/opencl1.2-c.inc) 153 - -add_custom_target(opencl1.2-c.inc_target DEPENDS ${INC_DIR}/opencl1.2-c.inc) 154 - -add_dependencies(amd_comgr opencl1.2-c.inc_target) 155 - -file(APPEND ${GEN_LIBRARY_INC_FILE} "#include \"opencl1.2-c.inc\"\n") 156 - - 157 - -add_custom_command(OUTPUT ${INC_DIR}/opencl2.0-c.inc 158 - - COMMAND bc2h ${CMAKE_CURRENT_BINARY_DIR}/opencl2.0-c.pch 159 - - ${INC_DIR}/opencl2.0-c.inc 160 - - opencl2_0_c 161 - - DEPENDS bc2h ${CMAKE_CURRENT_BINARY_DIR}/opencl2.0-c.pch 162 - - COMMENT "Generating opencl2.0-c.inc" 163 - -) 164 - -set_property(DIRECTORY APPEND PROPERTY 165 - - ADDITIONAL_MAKE_CLEAN_FILES ${INC_DIR}/opencl2.0-c.inc) 166 - -add_custom_target(opencl2.0-c.inc_target DEPENDS ${INC_DIR}/opencl2.0-c.inc) 167 - -add_dependencies(amd_comgr opencl2.0-c.inc_target) 168 - -file(APPEND ${GEN_LIBRARY_INC_FILE} "#include \"opencl2.0-c.inc\"\n") 169 - - 170 - -# Generate function to select libraries for a given GFXIP number. 171 - -file(APPEND ${GEN_LIBRARY_INC_FILE} "#include \"llvm/ADT/StringRef.h\"\n") 172 - -file(APPEND ${GEN_LIBRARY_INC_FILE} 173 - - "static std::tuple<const char*, const void*, size_t> get_oclc_isa_version(llvm::StringRef gfxip) {") 174 - +set(TARGETS_DEFS "") 175 - +list(APPEND TARGETS_DEFS "#ifndef AMD_DEVICE_LIBS_TARGET\n#define AMD_DEVICE_LIBS_TARGET(t)\n#endif") 176 - +list(APPEND TARGETS_DEFS "#ifndef AMD_DEVICE_LIBS_GFXIP\n#define AMD_DEVICE_LIBS_GFXIP(t, g)\n#endif") 177 - +list(APPEND TARGETS_DEFS "#ifndef AMD_DEVICE_LIBS_FUNCTION\n#define AMD_DEVICE_LIBS_FUNCTION(t, f)\n#endif") 178 - +list(APPEND TARGETS_DEFS "") 179 - foreach(AMDGCN_LIB_TARGET ${AMD_DEVICE_LIBS_TARGETS}) 180 - + list(APPEND TARGETS_DEFS "AMD_DEVICE_LIBS_TARGET(${AMDGCN_LIB_TARGET})") 181 - + # Generate function to select libraries for a given GFXIP number. 182 - if (${AMDGCN_LIB_TARGET} MATCHES "^oclc_isa_version_.+$") 183 - string(REGEX REPLACE "^oclc_isa_version_(.+)$" "\\1" gfxip ${AMDGCN_LIB_TARGET}) 184 - - file(APPEND ${GEN_LIBRARY_INC_FILE} 185 - - "if (gfxip == \"${gfxip}\") return std::make_tuple(\"${AMDGCN_LIB_TARGET}.bc\", ${AMDGCN_LIB_TARGET}_lib, ${AMDGCN_LIB_TARGET}_lib_size);") 186 - + list(APPEND TARGETS_DEFS "AMD_DEVICE_LIBS_GFXIP(${AMDGCN_LIB_TARGET}, \"${gfxip}\")") 187 - endif() 188 - -endforeach() 189 - -file(APPEND ${GEN_LIBRARY_INC_FILE} 190 - - "return std::make_tuple(nullptr, nullptr, 0); }") 191 - - 192 - -# Generate function to select libraries for given feature. 193 - -foreach(AMDGCN_LIB_TARGET ${AMD_DEVICE_LIBS_TARGETS}) 194 - + # Generate function to select libraries for given feature. 195 - if (${AMDGCN_LIB_TARGET} MATCHES "^oclc_.*_on$") 196 - string(REGEX REPLACE "^oclc_(.*)_on" "\\1" function ${AMDGCN_LIB_TARGET}) 197 - - file(APPEND ${GEN_LIBRARY_INC_FILE} 198 - - "static std::tuple<const char*, const void*, size_t> get_oclc_${function}(bool on) { \ 199 - - return std::make_tuple( \ 200 - - on ? \"oclc_${function}_on_lib.bc\" : \"oclc_${function}_off_lib.bc\", \ 201 - - on ? oclc_${function}_on_lib : oclc_${function}_off_lib, \ 202 - - on ? oclc_${function}_on_lib_size : oclc_${function}_off_lib_size \ 203 - - ); }") 204 - + list(APPEND TARGETS_DEFS "AMD_DEVICE_LIBS_FUNCTION(${AMDGCN_LIB_TARGET}, ${function})") 205 - endif() 206 - endforeach() 207 - 208 - -# Generate function yield all libraries. 209 - -file(APPEND ${GEN_LIBRARY_INC_FILE} "\n#include \"llvm/ADT/ArrayRef.h\"\n") 210 - -file(APPEND ${GEN_LIBRARY_INC_FILE} 211 - - "llvm::ArrayRef<std::tuple<llvm::StringRef, llvm::StringRef>> COMGR::getDeviceLibraries() { \ 212 - - static std::tuple<llvm::StringRef, llvm::StringRef> DeviceLibs[] = {") 213 - -foreach(AMDGCN_LIB_TARGET ${AMD_DEVICE_LIBS_TARGETS}) 214 - - file(APPEND ${GEN_LIBRARY_INC_FILE} 215 - - "{\"${AMDGCN_LIB_TARGET}.bc\", llvm::StringRef(reinterpret_cast<const char *>(${AMDGCN_LIB_TARGET}_lib), ${AMDGCN_LIB_TARGET}_lib_size)},") 216 - -endforeach() 217 - -file(APPEND ${GEN_LIBRARY_INC_FILE} 218 - - "}; \ 219 - - return DeviceLibs; \ 220 - - }") 221 - +list(APPEND TARGETS_DEFS "") 222 - +list(APPEND TARGETS_DEFS "#undef AMD_DEVICE_LIBS_TARGET") 223 - +list(APPEND TARGETS_DEFS "#undef AMD_DEVICE_LIBS_GFXIP") 224 - +list(APPEND TARGETS_DEFS "#undef AMD_DEVICE_LIBS_FUNCTION") 225 - + 226 - +list(JOIN TARGETS_DEFS "\n" TARGETS_DEFS) 227 - +file(GENERATE OUTPUT ${GEN_LIBRARY_DEFS_INC_FILE} CONTENT "${TARGETS_DEFS}") 228 - 229 - include_directories(${INC_DIR}) 230 - diff --git a/cmake/bc2h.cmake b/cmake/bc2h.cmake 231 - index 146fe2b..9134985 100644 232 - --- a/cmake/bc2h.cmake 233 - +++ b/cmake/bc2h.cmake 234 - @@ -1,40 +1,41 @@ 235 - -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bc2h.c 236 - -"#include <stdio.h>\n" 237 - -"int main(int argc, char **argv){\n" 238 - -" FILE *ifp, *ofp;\n" 239 - -" int c, i, l;\n" 240 - -" if (argc != 4) return 1;\n" 241 - -" ifp = fopen(argv[1], \"rb\");\n" 242 - -" if (!ifp) return 1;\n" 243 - -" i = fseek(ifp, 0, SEEK_END);\n" 244 - -" if (i < 0) return 1;\n" 245 - -" l = ftell(ifp);\n" 246 - -" if (l < 0) return 1;\n" 247 - -" i = fseek(ifp, 0, SEEK_SET);\n" 248 - -" if (i < 0) return 1;\n" 249 - -" ofp = fopen(argv[2], \"wb+\");\n" 250 - -" if (!ofp) return 1;\n" 251 - -" fprintf(ofp, \"#define %s_size %d\\n\\n\"\n" 252 - -" \"#if defined __GNUC__\\n\"\n" 253 - -" \"__attribute__((aligned (4096)))\\n\"\n" 254 - -" \"#elif defined _MSC_VER\\n\"\n" 255 - -" \"__declspec(align(4096))\\n\"\n" 256 - -" \"#endif\\n\"\n" 257 - -" \"static const unsigned char %s[%s_size+1] = {\",\n" 258 - -" argv[3], l,\n" 259 - -" argv[3], argv[3]);\n" 260 - -" i = 0;\n" 261 - -" while ((c = getc(ifp)) != EOF) {\n" 262 - -" if (0 == (i&7)) fprintf(ofp, \"\\n \");\n" 263 - -" fprintf(ofp, \" 0x%02x,\", c);\n" 264 - -" ++i;\n" 265 - -" }\n" 266 - -" fprintf(ofp, \" 0x00\\n};\\n\\n\");\n" 267 - -" fclose(ifp);\n" 268 - -" fclose(ofp);\n" 269 - -" return 0;\n" 270 - -"}\n" 271 - -) 272 - +file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/bc2h.c 273 - + CONTENT 274 - +"#include <stdio.h> 275 - +int main(int argc, char **argv){ 276 - + FILE *ifp, *ofp; 277 - + int c, i, l; 278 - + if (argc != 4) return 1; 279 - + ifp = fopen(argv[1], \"rb\"); 280 - + if (!ifp) return 1; 281 - + i = fseek(ifp, 0, SEEK_END); 282 - + if (i < 0) return 1; 283 - + l = ftell(ifp); 284 - + if (l < 0) return 1; 285 - + i = fseek(ifp, 0, SEEK_SET); 286 - + if (i < 0) return 1; 287 - + ofp = fopen(argv[2], \"wb+\"); 288 - + if (!ofp) return 1; 289 - + fprintf(ofp, \"#define %s_size %d\\n\\n\" 290 - + \"#if defined __GNUC__\\n\" 291 - + \"__attribute__((aligned (4096)))\\n\" 292 - + \"#elif defined _MSC_VER\\n\" 293 - + \"__declspec(align(4096))\\n\" 294 - + \"#endif\\n\" 295 - + \"static const unsigned char %s[%s_size+1] = {\", 296 - + argv[3], l, 297 - + argv[3], argv[3]); 298 - + i = 0; 299 - + while ((c = getc(ifp)) != EOF) { 300 - + if (0 == (i&7)) fprintf(ofp, \"\\n \"); 301 - + fprintf(ofp, \" 0x%02x,\", c); 302 - + ++i; 303 - + } 304 - + fprintf(ofp, \" 0x00\\n};\\n\\n\"); 305 - + fclose(ifp); 306 - + fclose(ofp); 307 - + return 0; 308 - +} 309 - +") 310 - 311 - add_executable(bc2h ${CMAKE_CURRENT_BINARY_DIR}/bc2h.c) 312 - if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") 313 - diff --git a/src/comgr-device-libs.cpp b/src/comgr-device-libs.cpp 314 - index 4d2b914..80786d1 100644 315 - --- a/src/comgr-device-libs.cpp 316 - +++ b/src/comgr-device-libs.cpp 317 - @@ -35,7 +35,7 @@ 318 - 319 - #include "comgr-device-libs.h" 320 - #include "comgr.h" 321 - -#include "libraries.inc" 322 - +#include "comgr-libraries.h" 323 - #include "llvm/ADT/StringSwitch.h" 324 - #include <cstdint> 325 - 326 - diff --git a/src/comgr-libraries.h b/src/comgr-libraries.h 327 - new file mode 100644 328 - index 0000000..3caa0a0 329 - --- /dev/null 330 - +++ b/src/comgr-libraries.h 331 - @@ -0,0 +1,34 @@ 332 - +#include "libraries.inc" 333 - +#include "opencl1.2-c.inc" 334 - +#include "opencl2.0-c.inc" 335 - +#include "llvm/ADT/StringRef.h" 336 - +#include "llvm/ADT/ArrayRef.h" 337 - + 338 - +static std::tuple<const char*, const void*, size_t> get_oclc_isa_version(llvm::StringRef gfxip) { 339 - +#define AMD_DEVICE_LIBS_GFXIP(target, target_gfxip) \ 340 - + if (gfxip == target_gfxip) return std::make_tuple(#target ".bc", target##_lib, target##_lib_size); 341 - +#include "libraries_defs.inc" 342 - + 343 - + return std::make_tuple(nullptr, nullptr, 0); 344 - +} 345 - + 346 - +#define AMD_DEVICE_LIBS_FUNCTION(target, function) \ 347 - + static std::tuple<const char*, const void*, size_t> get_oclc_##function(bool on) { \ 348 - + return std::make_tuple( \ 349 - + on ? "oclc_" #function "_on_lib.bc" : "oclc_" #function "_off_lib.bc", \ 350 - + on ? oclc_##function##_on_lib : oclc_##function##_off_lib, \ 351 - + on ? oclc_##function##_on_lib_size : oclc_##function##_off_lib_size \ 352 - + ); \ 353 - + } 354 - +#include "libraries_defs.inc" 355 - + 356 - +llvm::ArrayRef<std::tuple<llvm::StringRef, llvm::StringRef>> COMGR::getDeviceLibraries() { 357 - + static std::tuple<llvm::StringRef, llvm::StringRef> DeviceLibs[] = { 358 - +#define AMD_DEVICE_LIBS_TARGET(target) \ 359 - + {#target ".bc", llvm::StringRef(reinterpret_cast<const char *>(target##_lib), target##_lib_size)}, 360 - +#include "libraries_defs.inc" 361 - + }; 362 - + return DeviceLibs; 363 - +} 364 - + 365 - +
+2 -3
pkgs/development/libraries/rocm-comgr/default.nix pkgs/development/rocm-modules/5/rocm-comgr/default.nix
··· 15 15 else throw "Unsupported ROCm LLVM platform"; 16 16 in stdenv.mkDerivation (finalAttrs: { 17 17 pname = "rocm-comgr"; 18 - version = "5.4.4"; 18 + version = "5.7.0"; 19 19 20 20 src = fetchFromGitHub { 21 21 owner = "RadeonOpenCompute"; 22 22 repo = "ROCm-CompilerSupport"; 23 23 rev = "rocm-${finalAttrs.version}"; 24 - hash = "sha256-qLsrBTeSop7lIQv8gZDwgpvGZJOAq90zsvMi1QpfbAs="; 24 + hash = "sha256-QB3G0V92UTW67hD6+zSuExN1+eMT820iYSlMyZeWSFw="; 25 25 }; 26 26 27 - patches = [ ./cmake.patch ]; 28 27 sourceRoot = "${finalAttrs.src.name}/lib/comgr"; 29 28 30 29 nativeBuildInputs = [
-58
pkgs/development/libraries/rocm-core/default.nix
··· 1 - { lib 2 - , stdenv 3 - , fetchFromGitHub 4 - , runCommand 5 - , substituteAll 6 - , cmake 7 - }: 8 - 9 - let 10 - rocm_version = with lib; concatStrings (intersperse "0" (splitString "." stdenv.cc.version)); 11 - in stdenv.mkDerivation (finalAttrs: { 12 - pname = "rocm-core"; 13 - version = stdenv.cc.version; 14 - 15 - # Based on https://github.com/rocm-arch/rocm-arch/tree/ad0b15690d403e5822db062ffff4db3912de6669/rocm-core 16 - src = let 17 - rocm_major = lib.versions.major finalAttrs.version; 18 - rocm_minor = lib.versions.minor finalAttrs.version; 19 - rocm_patch = lib.versions.patch finalAttrs.version; 20 - 21 - cmake_lists = substituteAll { 22 - inherit rocm_version; 23 - src = ./src/CMakeLists.txt; 24 - }; 25 - 26 - version_c = substituteAll { 27 - inherit rocm_major rocm_minor rocm_patch; 28 - src = ./src/rocm_version.c; 29 - }; 30 - 31 - version_h = substituteAll { 32 - inherit rocm_major rocm_minor rocm_patch; 33 - src = ./src/rocm_version.h; 34 - }; 35 - in runCommand "rocm-core-${finalAttrs.version}-source" { preferLocalBuild = true; } '' 36 - mkdir -p $out/rocm-core 37 - ln -s ${cmake_lists} $out/CMakeLists.txt 38 - ln -s ${version_c} $out/rocm_version.c 39 - ln -s ${version_h} $out/rocm-core/rocm_version.h 40 - ''; 41 - 42 - nativeBuildInputs = [ cmake ]; 43 - 44 - postInstall = '' 45 - mkdir -p $out/include 46 - cp -a ../rocm-core $out/include 47 - ln -s $out/include/rocm-core/rocm_version.h $out/include 48 - ln -s $out/lib/librocm-core.so.1.0.${rocm_version} $out/lib/librocm-core.so.1 49 - ''; 50 - 51 - meta = with lib; { 52 - description = "ROCm core"; 53 - homepage = "https://docs.amd.com"; 54 - license = with licenses; [ ncsa ]; # See src/rocm_version.h 55 - maintainers = teams.rocm.members; 56 - platforms = platforms.linux; 57 - }; 58 - })
-5
pkgs/development/libraries/rocm-core/src/CMakeLists.txt
··· 1 - cmake_minimum_required(VERSION 3.23) 2 - project(rocm-core) 3 - add_library(rocm-core SHARED rocm_version.c) 4 - set_target_properties(rocm-core PROPERTIES VERSION "1.0.@rocm_version@") 5 - install(TARGETS rocm-core LIBRARY DESTINATION lib)
-10
pkgs/development/libraries/rocm-core/src/rocm_version.c
··· 1 - #include "rocm-core/rocm_version.h" 2 - 3 - VerErrors getROCmVersion(unsigned int *Major, unsigned int *Minor, 4 - unsigned int *Patch) { 5 - *Major = @rocm_major@; 6 - *Minor = @rocm_minor@; 7 - *Patch = @rocm_patch@; 8 - 9 - return 0; 10 - }
-82
pkgs/development/libraries/rocm-core/src/rocm_version.h
··· 1 - //////////////////////////////////////////////////////////////////////////////// 2 - // 3 - // The University of Illinois/NCSA 4 - // Open Source License (NCSA) 5 - // 6 - // Copyright (c) 2014-2021, Advanced Micro Devices, Inc. All rights reserved. 7 - // 8 - // Developed by: 9 - // 10 - // AMD Research and AMD HSA Software Development 11 - // 12 - // Advanced Micro Devices, Inc. 13 - // 14 - // www.amd.com 15 - // 16 - // Permission is hereby granted, free of charge, to any person obtaining a copy 17 - // of this software and associated documentation files (the "Software"), to 18 - // deal with the Software without restriction, including without limitation 19 - // the rights to use, copy, modify, merge, publish, distribute, sublicense, 20 - // and/or sell copies of the Software, and to permit persons to whom the 21 - // Software is furnished to do so, subject to the following conditions: 22 - // 23 - // - Redistributions of source code must retain the above copyright notice, 24 - // this list of conditions and the following disclaimers. 25 - // - Redistributions in binary form must reproduce the above copyright 26 - // notice, this list of conditions and the following disclaimers in 27 - // the documentation and/or other materials provided with the distribution. 28 - // - Neither the names of Advanced Micro Devices, Inc, 29 - // nor the names of its contributors may be used to endorse or promote 30 - // products derived from this Software without specific prior written 31 - // permission. 32 - // 33 - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 34 - // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 35 - // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 36 - // THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 37 - // OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 38 - // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 39 - // DEALINGS WITH THE SOFTWARE. 40 - // 41 - //////////////////////////////////////////////////////////////////////////////// 42 - 43 - 44 - #ifndef _ROCM_VERSION_H_ 45 - #define _ROCM_VERSION_H_ 46 - 47 - 48 - #ifdef __cplusplus 49 - extern "C" { 50 - #endif /* __cplusplus */ 51 - 52 - 53 - #define ROCM_VERSION_MAJOR @rocm_major@ 54 - #define ROCM_VERSION_MINOR @rocm_minor@ 55 - #define ROCM_VERSION_PATCH @rocm_patch@ 56 - 57 - 58 - typedef enum { 59 - VerSuccess=0, 60 - VerIncorrecPararmeters, 61 - VerValuesNotDefined, 62 - VerErrorMAX //This should always be last value in the enumerations 63 - } VerErrors; 64 - 65 - 66 - // API for getting the verion 67 - // Return val : VerErros : API execution status. The parameters are valid only when the exetution status is SUCCESS==0 68 - VerErrors getROCmVersion(unsigned int* Major, unsigned int* Minor, unsigned int* Patch) __attribute__((nonnull)) ; 69 - // Usage : 70 - // int mj=0,mn=0,p=0,ret=0; 71 - // ret=getROCMVersion(&mj,&mn,&p); 72 - // if(ret !=VerSuccess ) // error occured 73 - // 74 - // check for the values and 75 - // 76 - 77 - 78 - #ifdef __cplusplus 79 - } // end extern "C" block 80 - #endif 81 - 82 - #endif //_ROCM_VERSION_H_ header guard
pkgs/development/libraries/rocm-device-libs/cmake.patch pkgs/development/rocm-modules/5/rocm-device-libs/cmake.patch
+2 -2
pkgs/development/libraries/rocm-device-libs/default.nix pkgs/development/rocm-modules/5/rocm-device-libs/default.nix
··· 14 14 else throw "Unsupported ROCm LLVM platform"; 15 15 in stdenv.mkDerivation (finalAttrs: { 16 16 pname = "rocm-device-libs"; 17 - version = "5.4.4"; 17 + version = "5.7.0"; 18 18 19 19 src = fetchFromGitHub { 20 20 owner = "RadeonOpenCompute"; 21 21 repo = "ROCm-Device-Libs"; 22 22 rev = "rocm-${finalAttrs.version}"; 23 - hash = "sha256-8gxvgy2GlROxM5qKtZVu5Lxa1FmTIVlBTpfp8rxhNhk="; 23 + hash = "sha256-f6/LAhJ2mBDO1/JloHvl7MJyDo3WutbXd4IDknA9nzM="; 24 24 }; 25 25 26 26 patches = [ ./cmake.patch ];
-26
pkgs/development/libraries/rocm-opencl-icd/default.nix
··· 1 - { lib 2 - , stdenv 3 - , callPackage 4 - , rocm-opencl-runtime 5 - }: 6 - 7 - stdenv.mkDerivation rec { 8 - pname = "rocm-opencl-icd"; 9 - version = rocm-opencl-runtime.version; 10 - 11 - dontUnpack = true; 12 - 13 - installPhase = '' 14 - mkdir -p $out/etc/OpenCL/vendors 15 - echo "${rocm-opencl-runtime}/lib/libamdocl64.so" > $out/etc/OpenCL/vendors/amdocl64.icd 16 - ''; 17 - 18 - passthru.impureTests = { rocm-opencl = callPackage ./test.nix { }; }; 19 - 20 - meta = with lib; { 21 - description = "OpenCL ICD definition for AMD GPUs using the ROCm stack"; 22 - license = licenses.mit; 23 - maintainers = with maintainers; [ lovesegfault ] ++ teams.rocm.members; 24 - platforms = platforms.linux; 25 - }; 26 - }
+10 -6
pkgs/development/libraries/rocm-opencl-icd/test.nix pkgs/development/rocm-modules/5/clr/test.nix
··· 1 - { lib, makeImpureTest, clinfo, rocm-opencl-icd, rocm-smi }: 2 - makeImpureTest { 3 - name = "rocm-opencl"; 4 - testedPackage = "rocm-opencl-icd"; 1 + { lib 2 + , makeImpureTest 3 + , clinfo 4 + , clr 5 + , rocm-smi 6 + }: 5 7 8 + makeImpureTest { 9 + name = "clr-icd"; 10 + testedPackage = "rocmPackages.clr"; 6 11 nativeBuildInputs = [ clinfo rocm-smi ]; 7 - 8 - OCL_ICD_VENDORS = "${rocm-opencl-icd}/etc/OpenCL/vendors/"; 12 + OCL_ICD_VENDORS = "${clr.icd}/etc/OpenCL/vendors"; 9 13 10 14 testScript = '' 11 15 # Test fails if the number of platforms is 0
-69
pkgs/development/libraries/rocm-opencl-runtime/default.nix
··· 1 - { lib 2 - , stdenv 3 - , fetchFromGitHub 4 - , rocmUpdateScript 5 - , addOpenGLRunpath 6 - , cmake 7 - , rocm-comgr 8 - , rocm-runtime 9 - , rocclr 10 - , glew 11 - , libX11 12 - , numactl 13 - }: 14 - 15 - stdenv.mkDerivation (finalAttrs: { 16 - pname = "rocm-opencl-runtime"; 17 - version = "5.4.4"; 18 - 19 - src = fetchFromGitHub { 20 - owner = "RadeonOpenCompute"; 21 - repo = "ROCm-OpenCL-Runtime"; 22 - rev = "rocm-${finalAttrs.version}"; 23 - hash = "sha256-E1+Y/fgp5b+7H1LN+O1fwVi0/XRCgvsiSxTY3u/q+8I="; 24 - }; 25 - 26 - nativeBuildInputs = [ cmake ]; 27 - 28 - buildInputs = [ 29 - rocm-comgr 30 - rocm-runtime 31 - glew 32 - libX11 33 - numactl 34 - ]; 35 - 36 - cmakeFlags = [ 37 - "-DAMD_OPENCL_PATH=${finalAttrs.src}" 38 - "-DROCCLR_PATH=${rocclr}" 39 - ]; 40 - 41 - dontStrip = true; 42 - 43 - # Remove clinfo, which is already provided through the 44 - # `clinfo` package. 45 - postInstall = '' 46 - rm -rf $out/bin 47 - ''; 48 - 49 - # Fix the ICD installation path for NixOS 50 - postPatch = '' 51 - substituteInPlace khronos/icd/loader/linux/icd_linux.c \ 52 - --replace 'ICD_VENDOR_PATH' '"${addOpenGLRunpath.driverLink}/etc/OpenCL/vendors/"' 53 - ''; 54 - 55 - passthru.updateScript = rocmUpdateScript { 56 - name = finalAttrs.pname; 57 - owner = finalAttrs.src.owner; 58 - repo = finalAttrs.src.repo; 59 - }; 60 - 61 - meta = with lib; { 62 - description = "OpenCL runtime for AMD GPUs, part of the ROCm stack"; 63 - homepage = "https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime"; 64 - license = with licenses; [ asl20 mit ]; 65 - maintainers = with maintainers; [ acowley lovesegfault ] ++ teams.rocm.members; 66 - platforms = platforms.linux; 67 - broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 68 - }; 69 - })
+5 -3
pkgs/development/libraries/rocm-runtime/default.nix pkgs/development/rocm-modules/5/rocm-runtime/default.nix
··· 16 16 17 17 stdenv.mkDerivation (finalAttrs: { 18 18 pname = "rocm-runtime"; 19 - version = "5.4.3"; 19 + version = "5.7.0"; 20 20 21 21 src = fetchFromGitHub { 22 22 owner = "RadeonOpenCompute"; 23 23 repo = "ROCR-Runtime"; 24 24 rev = "rocm-${finalAttrs.version}"; 25 - hash = "sha256-JkTXTQmdESHSFbA6HZdMK3pYEApz9aoAlMzdXayzdyY="; 25 + hash = "sha256-D7Ahan5cxDhqPtV5iDDNys0A4FlxQ9oVRa2EeMoY5Qk="; 26 26 }; 27 27 28 28 sourceRoot = "${finalAttrs.src.name}/src"; ··· 50 50 --replace 'hsa/include/hsa' 'include/hsa' 51 51 52 52 # We compile clang before rocm-device-libs, so patch it in afterwards 53 + # Replace object version: https://github.com/RadeonOpenCompute/ROCR-Runtime/issues/166 (TODO: Remove on LLVM update?) 53 54 substituteInPlace image/blit_src/CMakeLists.txt \ 54 - --replace '-cl-denorms-are-zero' '-cl-denorms-are-zero --rocm-device-lib-path=${rocm-device-libs}/amdgcn/bitcode' 55 + --replace '-cl-denorms-are-zero' '-cl-denorms-are-zero --rocm-device-lib-path=${rocm-device-libs}/amdgcn/bitcode' \ 56 + --replace '-mcode-object-version=4' '-mcode-object-version=5' 55 57 ''; 56 58 57 59 fixupPhase = ''
+2 -8
pkgs/development/libraries/rocm-thunk/default.nix pkgs/development/rocm-modules/5/rocm-thunk/default.nix
··· 4 4 , rocmUpdateScript 5 5 , pkg-config 6 6 , cmake 7 - , rocm-cmake 8 7 , libdrm 9 8 , numactl 10 - , valgrind 11 - , gcc 12 9 }: 13 10 14 11 stdenv.mkDerivation (finalAttrs: { 15 12 pname = "rocm-thunk"; 16 - version = "5.4.4"; 13 + version = "5.7.0"; 17 14 18 15 src = fetchFromGitHub { 19 16 owner = "RadeonOpenCompute"; 20 17 repo = "ROCT-Thunk-Interface"; 21 18 rev = "rocm-${finalAttrs.version}"; 22 - hash = "sha256-EU5toaKzVeZpdm/YhaQ0bXq0eoYwYQ5qGLUJzxgZVjE="; 19 + hash = "sha256-jAMBks2/JaXiA45B3qvLHY8fPeFcr1GHT5Jieuduqhw="; 23 20 }; 24 21 25 22 nativeBuildInputs = [ 26 23 pkg-config 27 24 cmake 28 - rocm-cmake 29 25 ]; 30 26 31 27 buildInputs = [ 32 28 libdrm 33 29 numactl 34 - valgrind 35 - gcc.cc.libgcc or null # TODO: unhack this? 36 30 ]; 37 31 38 32 cmakeFlags = [
+36 -12
pkgs/development/libraries/rocmlir/default.nix pkgs/development/rocm-modules/5/rocmlir/default.nix
··· 3 3 , fetchFromGitHub 4 4 , rocmUpdateScript 5 5 , cmake 6 + , rocm-cmake 6 7 , ninja 7 - , hip 8 - , rocminfo 8 + , clr 9 9 , git 10 10 , libxml2 11 11 , libedit 12 + , zstd 12 13 , zlib 13 14 , ncurses 14 - , python3 15 + , python3Packages 15 16 , buildRockCompiler ? false 17 + , buildTests ? false # `argument of type 'NoneType' is not iterable` 16 18 }: 17 19 18 20 # Theoretically, we could have our MLIR have an output 19 21 # with the source and built objects so that we can just 20 22 # use it as the external LLVM repo for this 21 23 let 24 + suffix = 25 + if buildRockCompiler 26 + then "-rock" 27 + else ""; 28 + 22 29 llvmNativeTarget = 23 30 if stdenv.isx86_64 then "X86" 24 31 else if stdenv.isAarch64 then "AArch64" 25 32 else throw "Unsupported ROCm LLVM platform"; 26 33 in stdenv.mkDerivation (finalAttrs: { 27 - pname = "rocmlir"; 28 - version = "5.4.1"; 34 + pname = "rocmlir${suffix}"; 35 + version = "5.7.0"; 29 36 30 37 outputs = [ 31 38 "out" ··· 37 44 owner = "ROCmSoftwarePlatform"; 38 45 repo = "rocMLIR"; 39 46 rev = "rocm-${finalAttrs.version}"; 40 - hash = "sha256-MokE7Ej8mLHTQeLYvKr7PPlsNG6ul91fqfXDlGu5JpI="; 47 + hash = "sha256-vPi4UVljohVAfnwDVQqeOVaJPa6v8aV5uBOtqLddTtc="; 41 48 }; 42 49 43 50 nativeBuildInputs = [ 44 51 cmake 52 + rocm-cmake 45 53 ninja 46 - ] ++ lib.optionals (!buildRockCompiler) [ 47 - hip 54 + clr 55 + python3Packages.python 56 + python3Packages.tomli 48 57 ]; 49 58 50 59 buildInputs = [ 51 60 git 52 61 libxml2 53 62 libedit 54 - python3 55 63 ]; 56 64 57 65 propagatedBuildInputs = [ 66 + zstd 58 67 zlib 59 68 ncurses 60 69 ]; 61 70 62 71 cmakeFlags = [ 63 72 "-DLLVM_TARGETS_TO_BUILD=AMDGPU;${llvmNativeTarget}" 73 + "-DLLVM_ENABLE_ZSTD=ON" 64 74 "-DLLVM_ENABLE_ZLIB=ON" 65 75 "-DLLVM_ENABLE_TERMINFO=ON" 76 + "-DROCM_PATH=${clr}" 77 + # Manually define CMAKE_INSTALL_<DIR> 78 + # See: https://github.com/NixOS/nixpkgs/pull/197838 79 + "-DCMAKE_INSTALL_BINDIR=bin" 80 + "-DCMAKE_INSTALL_LIBDIR=lib" 81 + "-DCMAKE_INSTALL_INCLUDEDIR=include" 66 82 ] ++ lib.optionals buildRockCompiler [ 67 83 "-DBUILD_FAT_LIBROCKCOMPILER=ON" 68 84 ] ++ lib.optionals (!buildRockCompiler) [ 69 - "-DROCM_PATH=${rocminfo}" 70 85 "-DROCM_TEST_CHIPSET=gfx000" 71 86 ]; 72 87 88 + postPatch = '' 89 + patchShebangs mlir 90 + 91 + substituteInPlace mlir/utils/performance/common/CMakeLists.txt \ 92 + --replace "/opt/rocm" "${clr}" 93 + ''; 94 + 73 95 dontBuild = true; 74 96 doCheck = true; 75 97 76 98 # Certain libs aren't being generated, try enabling tests next update 77 99 checkTarget = if buildRockCompiler 78 100 then "librockCompiler" 79 - else "check-mlir-miopen-build-only"; 101 + else if buildTests 102 + then "check-rocmlir" 103 + else "check-rocmlir-build-only"; 80 104 81 105 postInstall = let 82 - libPath = lib.makeLibraryPath [ zlib ncurses hip stdenv.cc.cc ]; 106 + libPath = lib.makeLibraryPath [ zstd zlib ncurses clr stdenv.cc.cc ]; 83 107 in lib.optionals (!buildRockCompiler) '' 84 108 mkdir -p $external/lib 85 109 cp -a external/llvm-project/llvm/lib/{*.a*,*.so*} $external/lib
+9 -5
pkgs/development/libraries/rocprim/default.nix pkgs/development/rocm-modules/5/rocprim/default.nix
··· 4 4 , rocmUpdateScript 5 5 , cmake 6 6 , rocm-cmake 7 - , hip 7 + , clr 8 8 , gtest 9 9 , gbenchmark 10 10 , buildTests ? false 11 11 , buildBenchmarks ? false 12 + , gpuTargets ? [ ] 12 13 }: 13 14 14 15 stdenv.mkDerivation (finalAttrs: { 15 16 pname = "rocprim"; 16 - version = "5.4.3"; 17 + version = "5.7.0"; 17 18 18 19 outputs = [ 19 20 "out" ··· 27 28 owner = "ROCmSoftwarePlatform"; 28 29 repo = "rocPRIM"; 29 30 rev = "rocm-${finalAttrs.version}"; 30 - hash = "sha256-Sqr3lbDMK1Gwucqmr/CHoxw/L6bGj3wlXoHzKTnTqoc="; 31 + hash = "sha256-+ukFWsWv3RhS+Z6tmR4TRT8QTYEDuAEk12F9Gv1eXGU="; 31 32 }; 32 33 33 34 nativeBuildInputs = [ 34 35 cmake 35 36 rocm-cmake 36 - hip 37 + clr 37 38 ]; 38 39 39 40 buildInputs = lib.optionals buildTests [ ··· 49 50 "-DCMAKE_INSTALL_BINDIR=bin" 50 51 "-DCMAKE_INSTALL_LIBDIR=lib" 51 52 "-DCMAKE_INSTALL_INCLUDEDIR=include" 53 + ] ++ lib.optionals (gpuTargets != [ ]) [ 54 + "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" 52 55 ] ++ lib.optionals buildTests [ 53 56 "-DBUILD_TEST=ON" 54 57 ] ++ lib.optionals buildBenchmarks [ ··· 58 61 postInstall = lib.optionalString buildTests '' 59 62 mkdir -p $test/bin 60 63 mv $out/bin/test_* $test/bin 64 + mv $out/bin/rocprim $test/bin 61 65 '' + lib.optionalString buildBenchmarks '' 62 66 mkdir -p $benchmark/bin 63 67 mv $out/bin/benchmark_* $benchmark/bin ··· 77 81 license = with licenses; [ mit ]; 78 82 maintainers = teams.rocm.members; 79 83 platforms = platforms.linux; 80 - broken = versions.minor finalAttrs.version != versions.minor hip.version; 84 + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 81 85 }; 82 86 })
-20
pkgs/development/libraries/rocprofiler/0000-dont-require-hsa_amd_aqlprofile.patch
··· 1 - diff --git a/src/util/hsa_rsrc_factory.cpp b/src/util/hsa_rsrc_factory.cpp 2 - index 643ff16..c08d98f 100644 3 - --- a/src/util/hsa_rsrc_factory.cpp 4 - +++ b/src/util/hsa_rsrc_factory.cpp 5 - @@ -127,15 +127,6 @@ HsaRsrcFactory::HsaRsrcFactory(bool initialize_hsa) : initialize_hsa_(initialize 6 - if (cpu_pool_ == NULL) CHECK_STATUS("CPU memory pool is not found", HSA_STATUS_ERROR); 7 - if (kern_arg_pool_ == NULL) CHECK_STATUS("Kern-arg memory pool is not found", HSA_STATUS_ERROR); 8 - 9 - - // Get AqlProfile API table 10 - - aqlprofile_api_ = {0}; 11 - -#ifdef ROCP_LD_AQLPROFILE 12 - - status = LoadAqlProfileLib(&aqlprofile_api_); 13 - -#else 14 - - status = hsa_api_.hsa_system_get_major_extension_table(HSA_EXTENSION_AMD_AQLPROFILE, hsa_ven_amd_aqlprofile_VERSION_MAJOR, sizeof(aqlprofile_api_), &aqlprofile_api_); 15 - -#endif 16 - - CHECK_STATUS("aqlprofile API table load failed", status); 17 - - 18 - // Get Loader API table 19 - loader_api_ = {0}; 20 - status = hsa_api_.hsa_system_get_major_extension_table(HSA_EXTENSION_AMD_LOADER, 1, sizeof(loader_api_), &loader_api_);
-66
pkgs/development/libraries/rocprofiler/default.nix
··· 1 - { lib 2 - , stdenv 3 - , fetchFromGitHub 4 - , rocmUpdateScript 5 - , cmake 6 - , rocm-runtime 7 - , rocm-thunk 8 - , roctracer 9 - , numactl 10 - }: 11 - 12 - stdenv.mkDerivation (finalAttrs: { 13 - pname = "rocprofiler"; 14 - version = "5.4.3"; 15 - 16 - src = fetchFromGitHub { 17 - owner = "ROCm-Developer-Tools"; 18 - repo = "rocprofiler"; 19 - rev = "rocm-${finalAttrs.version}"; 20 - hash = "sha256-CpD/+soMN8WTeSb5X7dsnZ596PMkw+4EVsVSvFtKCak="; 21 - }; 22 - 23 - patches = [ ./0000-dont-require-hsa_amd_aqlprofile.patch ]; 24 - nativeBuildInputs = [ cmake ]; 25 - 26 - buildInputs = [ 27 - rocm-thunk 28 - rocm-runtime 29 - numactl 30 - ]; 31 - 32 - cmakeFlags = [ 33 - "-DPROF_API_HEADER_PATH=${roctracer.src}/inc/ext" 34 - # Manually define CMAKE_INSTALL_<DIR> 35 - # See: https://github.com/NixOS/nixpkgs/pull/197838 36 - "-DCMAKE_INSTALL_BINDIR=bin" 37 - "-DCMAKE_INSTALL_LIBDIR=lib" 38 - "-DCMAKE_INSTALL_INCLUDEDIR=include" 39 - ]; 40 - 41 - postPatch = '' 42 - patchShebangs bin test 43 - 44 - substituteInPlace cmake_modules/env.cmake \ 45 - --replace "FATAL_ERROR \"AQL_PROFILE" "WARNING \"AQL_PROFILE" 46 - ''; 47 - 48 - postInstall = '' 49 - patchelf --set-rpath $out/lib:${lib.makeLibraryPath finalAttrs.buildInputs} $out/lib/rocprofiler/librocprof-tool.so 50 - ''; 51 - 52 - passthru.updateScript = rocmUpdateScript { 53 - name = finalAttrs.pname; 54 - owner = finalAttrs.src.owner; 55 - repo = finalAttrs.src.repo; 56 - }; 57 - 58 - meta = with lib; { 59 - description = "Profiling with perf-counters and derived metrics"; 60 - homepage = "https://github.com/ROCm-Developer-Tools/rocprofiler"; 61 - license = with licenses; [ mit ]; # mitx11 62 - maintainers = teams.rocm.members; 63 - platforms = platforms.linux; 64 - broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 65 - }; 66 - })
+8 -10
pkgs/development/libraries/rocr-debug-agent/default.nix pkgs/development/rocm-modules/5/rocr-debug-agent/default.nix
··· 3 3 , fetchFromGitHub 4 4 , rocmUpdateScript 5 5 , cmake 6 - , hip 6 + , clr 7 7 , git 8 8 , rocdbgapi 9 - , rocm-runtime 10 9 , elfutils 11 10 }: 12 11 13 12 stdenv.mkDerivation (finalAttrs: { 14 13 pname = "rocr-debug-agent"; 15 - version = "5.4.2"; 14 + version = "5.7.0"; 16 15 17 16 src = fetchFromGitHub { 18 17 owner = "ROCm-Developer-Tools"; 19 18 repo = "rocr_debug_agent"; 20 19 rev = "rocm-${finalAttrs.version}"; 21 - hash = "sha256-5l6svWSWCxVoyr1zJabxbt5rXQMtdZtHrf9gS2PcRKc="; 20 + hash = "sha256-AUDbNrFtUQ5Hm+uv5KMovh7P9wXQKLyRNx9gEQFnv6Y="; 22 21 }; 23 22 24 23 nativeBuildInputs = [ 25 24 cmake 26 - hip 25 + clr 27 26 git 28 27 ]; 29 28 30 29 buildInputs = [ 31 30 rocdbgapi 32 - rocm-runtime 33 31 elfutils 34 32 ]; 35 33 36 34 cmakeFlags = [ 37 - "-DCMAKE_MODULE_PATH=${hip}/lib/cmake/hip" 38 - "-DHIP_ROOT_DIR=${hip}" 39 - "-DHIP_PATH=${hip}" 35 + "-DCMAKE_MODULE_PATH=${clr}/lib/cmake/hip" 36 + "-DHIP_ROOT_DIR=${clr}" 37 + "-DHIP_PATH=${clr}" 40 38 ]; 41 39 42 40 # Weird install target ··· 56 54 license = with licenses; [ ncsa ]; 57 55 maintainers = teams.rocm.members; 58 56 platforms = platforms.linux; 59 - broken = versions.minor finalAttrs.version != versions.minor hip.version; 57 + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 60 58 }; 61 59 })
+9 -6
pkgs/development/libraries/rocrand/default.nix pkgs/development/rocm-modules/5/rocrand/default.nix
··· 4 4 , rocmUpdateScript 5 5 , cmake 6 6 , rocm-cmake 7 - , hip 7 + , clr 8 8 , gtest 9 9 , gbenchmark 10 10 , buildTests ? false 11 11 , buildBenchmarks ? false 12 + , gpuTargets ? [ ] 12 13 }: 13 14 14 15 stdenv.mkDerivation (finalAttrs: { 15 16 pname = "rocrand"; 16 - version = "5.4.3"; 17 + version = "5.7.0"; 17 18 18 19 outputs = [ 19 20 "out" ··· 27 28 owner = "ROCmSoftwarePlatform"; 28 29 repo = "rocRAND"; 29 30 rev = "rocm-${finalAttrs.version}"; 30 - hash = "sha256-xK1JRTW+7odlXRQV9WC6ZfXqRKow/TQ9grHCigw+/us="; 31 + hash = "sha256-cFH38fLD8tk6V9JERcqHokuwKemdDgHCZ75bZNEqmdY="; 31 32 fetchSubmodules = true; # For inline hipRAND 32 33 }; 33 34 34 35 nativeBuildInputs = [ 35 36 cmake 36 37 rocm-cmake 37 - hip 38 + clr 38 39 ]; 39 40 40 41 buildInputs = lib.optionals buildTests [ ··· 46 47 cmakeFlags = [ 47 48 "-DCMAKE_C_COMPILER=hipcc" 48 49 "-DCMAKE_CXX_COMPILER=hipcc" 49 - "-DHIP_ROOT_DIR=${hip}" 50 + "-DHIP_ROOT_DIR=${clr}" 50 51 # Manually define CMAKE_INSTALL_<DIR> 51 52 # See: https://github.com/NixOS/nixpkgs/pull/197838 52 53 "-DCMAKE_INSTALL_BINDIR=bin" 53 54 "-DCMAKE_INSTALL_LIBDIR=lib" 54 55 "-DCMAKE_INSTALL_INCLUDEDIR=include" 56 + ] ++ lib.optionals (gpuTargets != [ ]) [ 57 + "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" 55 58 ] ++ lib.optionals buildTests [ 56 59 "-DBUILD_TEST=ON" 57 60 ] ++ lib.optionals buildBenchmarks [ ··· 80 83 license = with licenses; [ mit ]; 81 84 maintainers = teams.rocm.members; 82 85 platforms = platforms.linux; 83 - broken = versions.minor finalAttrs.version != versions.minor hip.version; 86 + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 84 87 }; 85 88 })
+8 -5
pkgs/development/libraries/rocsolver/default.nix pkgs/development/rocm-modules/5/rocsolver/default.nix
··· 5 5 , cmake 6 6 , rocm-cmake 7 7 , rocblas 8 - , hip 8 + , rocsparse 9 + , clr 9 10 , fmt 10 11 , gtest 11 12 , gfortran ··· 17 18 18 19 stdenv.mkDerivation (finalAttrs: { 19 20 pname = "rocsolver"; 20 - version = "5.4.4"; 21 + version = "5.7.0"; 21 22 22 23 outputs = [ 23 24 "out" ··· 31 32 owner = "ROCmSoftwarePlatform"; 32 33 repo = "rocSOLVER"; 33 34 rev = "rocm-${finalAttrs.version}"; 34 - hash = "sha256-UHUcA9CVPuYFpE2DTvRrRMMj51yNPo5wMTKnByL2RTg="; 35 + hash = "sha256-qxmjm4tgpCnfJ2SqUXndk6y0MsPJUKHvjv/3Uc0smr4="; 35 36 }; 36 37 37 38 nativeBuildInputs = [ 38 39 cmake 39 40 rocm-cmake 40 - hip 41 + clr 41 42 ] ++ lib.optionals (buildTests || buildBenchmarks) [ 42 43 gfortran 43 44 ]; 44 45 45 46 buildInputs = [ 46 47 rocblas 48 + rocsparse 47 49 fmt 48 50 ] ++ lib.optionals buildTests [ 49 51 gtest ··· 53 55 54 56 cmakeFlags = [ 55 57 "-DCMAKE_CXX_COMPILER=hipcc" 58 + "-DCMAKE_CXX_FLAGS=-Wno-switch" # Way too many warnings 56 59 # Manually define CMAKE_INSTALL_<DIR> 57 60 # See: https://github.com/NixOS/nixpkgs/pull/197838 58 61 "-DCMAKE_INSTALL_BINDIR=bin" ··· 90 93 license = with licenses; [ bsd2 ]; 91 94 maintainers = teams.rocm.members; 92 95 platforms = platforms.linux; 93 - broken = versions.minor finalAttrs.version != versions.minor hip.version; 96 + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 94 97 }; 95 98 })
+8 -5
pkgs/development/libraries/rocsparse/default.nix pkgs/development/rocm-modules/5/rocsparse/default.nix
··· 6 6 , cmake 7 7 , rocm-cmake 8 8 , rocprim 9 - , hip 9 + , clr 10 10 , gfortran 11 11 , git 12 12 , gtest ··· 14 14 , python3Packages 15 15 , buildTests ? false 16 16 , buildBenchmarks ? false # Seems to depend on tests 17 + , gpuTargets ? [ ] 17 18 }: 18 19 19 20 stdenv.mkDerivation (finalAttrs: { 20 21 pname = "rocsparse"; 21 - version = "5.4.3"; 22 + version = "5.7.0"; 22 23 23 24 outputs = [ 24 25 "out" ··· 32 33 owner = "ROCmSoftwarePlatform"; 33 34 repo = "rocSPARSE"; 34 35 rev = "rocm-${finalAttrs.version}"; 35 - hash = "sha256-jzHD55c4rlPab5IAj2UzHTJI9MKhTfevsLthSZKOEzQ="; 36 + hash = "sha256-30q9bqgZJUaNrkMXTAG+Z34yjsQ5DpJP+WBcCiEmF58="; 36 37 }; 37 38 38 39 nativeBuildInputs = [ 39 40 cmake 40 41 rocm-cmake 41 - hip 42 + clr 42 43 gfortran 43 44 ]; 44 45 ··· 59 60 "-DCMAKE_INSTALL_BINDIR=bin" 60 61 "-DCMAKE_INSTALL_LIBDIR=lib" 61 62 "-DCMAKE_INSTALL_INCLUDEDIR=include" 63 + ] ++ lib.optionals (gpuTargets != [ ]) [ 64 + "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" 62 65 ] ++ lib.optionals (buildTests || buildBenchmarks) [ 63 66 "-DBUILD_CLIENTS_TESTS=ON" 64 67 "-DCMAKE_MATRICES_DIR=/build/source/matrices" ··· 141 144 license = with licenses; [ mit ]; 142 145 maintainers = teams.rocm.members; 143 146 platforms = platforms.linux; 144 - broken = versions.minor finalAttrs.version != versions.minor hip.version; 147 + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 145 148 }; 146 149 })
pkgs/development/libraries/rocsparse/deps.nix pkgs/development/rocm-modules/5/rocsparse/deps.nix
+9 -6
pkgs/development/libraries/rocthrust/default.nix pkgs/development/rocm-modules/5/rocthrust/default.nix
··· 5 5 , cmake 6 6 , rocm-cmake 7 7 , rocprim 8 - , hip 8 + , clr 9 9 , gtest 10 10 , buildTests ? false 11 11 , buildBenchmarks ? false 12 + , gpuTargets ? [ ] 12 13 }: 13 14 14 15 stdenv.mkDerivation (finalAttrs: { 15 16 pname = "rocthrust"; 16 - version = "5.4.3"; 17 + version = "5.7.0"; 17 18 18 19 outputs = [ 19 20 "out" ··· 27 28 owner = "ROCmSoftwarePlatform"; 28 29 repo = "rocThrust"; 29 30 rev = "rocm-${finalAttrs.version}"; 30 - hash = "sha256-JT2PX53N39H+EaThPHo2ol+BUjDQniSQlKMLiYD8NoM="; 31 + hash = "sha256-i0XCtJth8caVQT5oUgsxWXNzcePa02Gb7AQsthYTOv8="; 31 32 }; 32 33 33 34 nativeBuildInputs = [ 34 35 cmake 35 36 rocm-cmake 36 37 rocprim 37 - hip 38 + clr 38 39 ]; 39 40 40 41 buildInputs = lib.optionals buildTests [ ··· 43 44 44 45 cmakeFlags = [ 45 46 "-DCMAKE_CXX_COMPILER=hipcc" 46 - "-DHIP_ROOT_DIR=${hip}" 47 + "-DHIP_ROOT_DIR=${clr}" 47 48 # Manually define CMAKE_INSTALL_<DIR> 48 49 # See: https://github.com/NixOS/nixpkgs/pull/197838 49 50 "-DCMAKE_INSTALL_BINDIR=bin" 50 51 "-DCMAKE_INSTALL_LIBDIR=lib" 51 52 "-DCMAKE_INSTALL_INCLUDEDIR=include" 53 + ] ++ lib.optionals (gpuTargets != [ ]) [ 54 + "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" 52 55 ] ++ lib.optionals buildTests [ 53 56 "-DBUILD_TEST=ON" 54 57 ] ++ lib.optionals buildBenchmarks [ ··· 79 82 license = with licenses; [ asl20 ]; 80 83 maintainers = teams.rocm.members; 81 84 platforms = platforms.linux; 82 - broken = versions.minor finalAttrs.version != versions.minor hip.version; 85 + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 83 86 }; 84 87 })
+7 -8
pkgs/development/libraries/roctracer/default.nix pkgs/development/rocm-modules/5/roctracer/default.nix
··· 4 4 , rocmUpdateScript 5 5 , cmake 6 6 , clang 7 - , hip 7 + , clr 8 8 , rocm-device-libs 9 9 , rocprofiler 10 10 , libxml2 ··· 19 19 20 20 stdenv.mkDerivation (finalAttrs: { 21 21 pname = "roctracer"; 22 - version = "5.4.3"; 22 + version = "5.7.0"; 23 23 24 24 outputs = [ 25 25 "out" ··· 33 33 owner = "ROCm-Developer-Tools"; 34 34 repo = "roctracer"; 35 35 rev = "rocm-${finalAttrs.version}"; 36 - hash = "sha256-5vYUNczylB2ehlvhq1u/H8KUXt8ku2E+jawKrKsU7LY="; 36 + hash = "sha256-P6QYyAjMRwFFWKF8AhbrYGe+mYVJXdbBW1or6vcobYU="; 37 37 }; 38 38 39 39 nativeBuildInputs = [ 40 40 cmake 41 41 clang 42 - hip 42 + clr 43 43 ] ++ lib.optionals buildDocs [ 44 44 doxygen 45 45 graphviz 46 46 ]; 47 47 48 48 buildInputs = [ 49 - rocm-device-libs 50 49 rocprofiler 51 50 libxml2 52 51 python3Packages.python ··· 54 53 ]; 55 54 56 55 cmakeFlags = [ 57 - "-DCMAKE_MODULE_PATH=${hip}/hip/cmake" 56 + "-DCMAKE_MODULE_PATH=${clr}/hip/cmake" 58 57 # Manually define CMAKE_INSTALL_<DIR> 59 58 # See: https://github.com/NixOS/nixpkgs/pull/197838 60 59 "-DCMAKE_INSTALL_BINDIR=bin" ··· 85 84 find $out/test -executable -type f -exec mv {} $test/bin \; 86 85 rm $test/bin/{*.sh,*.py} 87 86 patchelf --set-rpath $out/lib:${lib.makeLibraryPath ( 88 - finalAttrs.buildInputs ++ [ hip gcc-unwrapped.lib rocm-runtime ])} $test/bin/* 87 + finalAttrs.buildInputs ++ [ clr gcc-unwrapped.lib rocm-runtime ])} $test/bin/* 89 88 rm -rf $out/test 90 89 ''; 91 90 ··· 101 100 license = with licenses; [ mit ]; # mitx11 102 101 maintainers = teams.rocm.members; 103 102 platforms = platforms.linux; 104 - broken = versions.minor finalAttrs.version != versions.minor hip.version; 103 + broken = versions.minor finalAttrs.version != versions.minor clr.version; 105 104 }; 106 105 })
+8 -4
pkgs/development/libraries/rocwmma/0000-dont-fetch-googletest.patch pkgs/development/rocm-modules/5/rocwmma/0000-dont-fetch-googletest.patch
··· 1 1 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt 2 - index e1160bb..2a5462e 100644 2 + index 0d00883..86ce282 100644 3 3 --- a/test/CMakeLists.txt 4 4 +++ b/test/CMakeLists.txt 5 - @@ -30,26 +30,6 @@ cmake_dependent_option( ROCWMMA_BUILD_VALIDATION_TESTS "Build validation tests" 5 + @@ -30,30 +30,6 @@ cmake_dependent_option( ROCWMMA_BUILD_VALIDATION_TESTS "Build validation tests" 6 6 cmake_dependent_option( ROCWMMA_BUILD_BENCHMARK_TESTS "Build benchmarking tests" OFF "ROCWMMA_BUILD_TESTS" OFF ) 7 7 cmake_dependent_option( ROCWMMA_BUILD_EXTENDED_TESTS "Build extended test parameter coverage" OFF "ROCWMMA_BUILD_TESTS" OFF ) 8 8 ··· 12 12 -FetchContent_Declare( 13 13 - googletest 14 14 - GIT_REPOSITORY https://github.com/google/googletest.git 15 - - GIT_TAG 609281088cfefc76f9d0ce82e1ff6c30cc3591e5 15 + - GIT_TAG release-1.12.1 16 16 -) 17 17 -FetchContent_GetProperties(googletest) 18 18 -if(NOT googletest_POPULATED) 19 + - 19 20 - # Fetch the content using default details 20 21 - FetchContent_Populate(googletest) 21 22 - # Save the shared libs setting, then force to static libs 22 23 - set(BUILD_SHARED_LIBS_OLD ${BUILD_SHARED_LIBS}) 23 24 - set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "Build SHARED libraries" FORCE) 25 + - 24 26 - # Add gtest targets as static libs 25 27 - add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR}) 28 + - 26 29 - # Restore shared libs setting 27 30 - set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_OLD} CACHE INTERNAL "Build SHARED libraries" FORCE) 28 31 -endif() 29 - 32 + - 30 33 set(ROCWMMA_TEST_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}) 31 34 set(ROCWMMA_COMMON_TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/hip_device.cpp 35 + ${CMAKE_CURRENT_SOURCE_DIR}/rocwmma_gtest_main.cpp)
+10 -51
pkgs/development/libraries/rocwmma/default.nix pkgs/development/rocm-modules/5/rocwmma/default.nix
··· 4 4 , rocmUpdateScript 5 5 , cmake 6 6 , rocm-cmake 7 - , hip 7 + , rocm-smi 8 + , clr 8 9 , openmp 9 10 , gtest 10 11 , rocblas 11 - , texlive 12 - , doxygen 13 - , sphinx 14 - , python3Packages 15 - , buildDocs ? true 16 - , buildTests ? false 12 + , buildTests ? false # Will likely fail building because wavefront shifts are not supported for certain archs 17 13 , buildExtendedTests ? false 18 14 , buildBenchmarks ? false 19 15 , buildSamples ? false 20 16 , gpuTargets ? [ ] # gpuTargets = [ "gfx908:xnack-" "gfx90a:xnack-" "gfx90a:xnack+" ... ] 21 17 }: 22 18 23 - let 24 - latex = lib.optionalAttrs buildDocs texlive.combine { 25 - inherit (texlive) scheme-small 26 - latexmk 27 - tex-gyre 28 - fncychap 29 - wrapfig 30 - capt-of 31 - framed 32 - needspace 33 - tabulary 34 - varwidth 35 - titlesec; 36 - }; 37 - in stdenv.mkDerivation (finalAttrs: { 19 + stdenv.mkDerivation (finalAttrs: { 38 20 pname = "rocwmma"; 39 - version = "5.4.3"; 21 + version = "5.7.0"; 40 22 41 23 outputs = [ 42 24 "out" 43 - ] ++ lib.optionals buildDocs [ 44 - "doc" 45 25 ] ++ lib.optionals (buildTests || buildBenchmarks) [ 46 26 "test" 47 27 ] ++ lib.optionals buildBenchmarks [ ··· 54 34 owner = "ROCmSoftwarePlatform"; 55 35 repo = "rocWMMA"; 56 36 rev = "rocm-${finalAttrs.version}"; 57 - hash = "sha256-HUJPb6IahBgl/v+W4kXludBTNAjRm8k6v0jxKAX+qZM="; 37 + hash = "sha256-/EuBBSjhlMwJfsqYvRb9oCNC0hNkEa1JH1KUDLMSs08="; 58 38 }; 59 39 60 40 patches = lib.optionals (buildTests || buildBenchmarks) [ ··· 64 44 nativeBuildInputs = [ 65 45 cmake 66 46 rocm-cmake 67 - hip 47 + clr 68 48 ]; 69 49 70 50 buildInputs = [ 71 51 openmp 72 52 ] ++ lib.optionals (buildTests || buildBenchmarks) [ 53 + rocm-smi 73 54 gtest 74 55 rocblas 75 - ] ++ lib.optionals buildDocs [ 76 - latex 77 - doxygen 78 - sphinx 79 - python3Packages.sphinx-rtd-theme 80 - python3Packages.breathe 81 56 ]; 82 57 83 58 cmakeFlags = [ 84 59 "-DCMAKE_CXX_COMPILER=hipcc" 85 60 "-DROCWMMA_BUILD_TESTS=${if buildTests || buildBenchmarks then "ON" else "OFF"}" 86 - "-DROCWMMA_BUILD_VALIDATION_TESTS=ON" 87 61 "-DROCWMMA_BUILD_SAMPLES=${if buildSamples then "ON" else "OFF"}" 88 - "-DROCWMMA_VALIDATE_WITH_ROCBLAS=ON" 89 62 # Manually define CMAKE_INSTALL_<DIR> 90 63 # See: https://github.com/NixOS/nixpkgs/pull/197838 91 64 "-DCMAKE_INSTALL_BINDIR=bin" ··· 100 73 "-DROCWMMA_BENCHMARK_WITH_ROCBLAS=ON" 101 74 ]; 102 75 103 - postPatch = lib.optionalString buildDocs '' 104 - patchShebangs docs/*.sh 105 - ''; 106 - 107 - # Unfortunately, it seems like we have to call make on this manually 108 - # -DROCWMMA_BUILD_DOCS=ON is invalid, despite being on the README 109 - postBuild = lib.optionalString buildDocs '' 110 - export HOME=$(mktemp -d) 111 - ../docs/run_doc.sh 112 - ''; 113 - 114 - postInstall = lib.optionalString buildDocs '' 115 - mv ../docs/source/_build/html $out/share/doc/rocwmma 116 - mv ../docs/source/_build/latex/rocWMMA.pdf $out/share/doc/rocwmma 117 - '' + lib.optionalString (buildTests || buildBenchmarks) '' 76 + postInstall = lib.optionalString (buildTests || buildBenchmarks) '' 118 77 mkdir -p $test/bin 119 78 mv $out/bin/{*_test,*-validate} $test/bin 120 79 '' + lib.optionalString buildBenchmarks '' ··· 141 100 license = with licenses; [ mit ]; 142 101 maintainers = teams.rocm.members; 143 102 platforms = platforms.linux; 144 - broken = versions.minor finalAttrs.version != versions.minor hip.version; 103 + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 145 104 }; 146 105 })
+8 -11
pkgs/development/libraries/science/math/magma/generic.nix
··· 18 18 , gfortran 19 19 , cudaCapabilities ? cudaPackages.cudaFlags.cudaCapabilities 20 20 , gpuTargets ? [ ] # Non-CUDA targets, that is HIP 21 - , hip 22 - , hipblas 23 - , hipsparse 21 + , rocmPackages 24 22 , lapack 25 23 , lib 26 24 , libpthreadstubs 27 25 , magmaRelease 28 26 , ninja 29 - , openmp 30 27 , rocmSupport ? false 31 28 , static ? false 32 29 , stdenv ··· 47 44 # NOTE: The hip.gpuTargets are prefixed with "gfx" instead of "sm" like cudaFlags.realArches. 48 45 # For some reason, Magma's CMakeLists.txt file does not handle the "gfx" prefix, so we must 49 46 # remove it. 50 - rocmArches = lists.map (x: strings.removePrefix "gfx" x) hip.gpuTargets; 47 + rocmArches = lists.map (x: strings.removePrefix "gfx" x) rocmPackages.clr.gpuTargets; 51 48 supportedRocmArches = lists.intersectLists rocmArches supportedGpuTargets; 52 49 unsupportedRocmArches = lists.subtractLists supportedRocmArches rocmArches; 53 50 ··· 125 122 ] ++ lists.optionals (strings.versionAtLeast cudaVersion "11.8") [ 126 123 cuda_profiler_api.dev # <cuda_profiler_api.h> 127 124 ]) ++ lists.optionals rocmSupport [ 128 - hip 129 - hipblas 130 - hipsparse 131 - openmp 125 + rocmPackages.clr 126 + rocmPackages.hipblas 127 + rocmPackages.hipsparse 128 + rocmPackages.llvm.openmp 132 129 ]; 133 130 134 131 cmakeFlags = [ ··· 142 139 "-DCMAKE_CXX_COMPILER=${backendStdenv.cc}/bin/c++" 143 140 "-DMAGMA_ENABLE_CUDA=ON" 144 141 ] ++ lists.optionals rocmSupport [ 145 - "-DCMAKE_C_COMPILER=${hip}/bin/hipcc" 146 - "-DCMAKE_CXX_COMPILER=${hip}/bin/hipcc" 142 + "-DCMAKE_C_COMPILER=${rocmPackages.clr}/bin/hipcc" 143 + "-DCMAKE_CXX_COMPILER=${rocmPackages.clr}/bin/hipcc" 147 144 "-DMAGMA_ENABLE_HIP=ON" 148 145 ]; 149 146
+26 -3
pkgs/development/libraries/tensile/default.nix pkgs/development/rocm-modules/5/tensile/default.nix
··· 3 3 , fetchFromGitHub 4 4 , rocmUpdateScript 5 5 , buildPythonPackage 6 + , pytestCheckHook 7 + , setuptools 6 8 , pyyaml 7 9 , msgpack 8 10 , pandas 11 + , joblib 12 + , filelock 13 + , rocminfo 9 14 }: 10 15 11 16 buildPythonPackage rec { 12 17 pname = "tensile"; 13 - version = "5.4.2"; 18 + version = "5.7.0"; 19 + format = "pyproject"; 14 20 15 21 src = fetchFromGitHub { 16 22 owner = "ROCmSoftwarePlatform"; 17 23 repo = "Tensile"; 18 24 rev = "rocm-${version}"; 19 - hash = "sha256-W6yr6mptfsiJSSzPCImgqI1EmsUv+l99SjqkoZsOjag="; 25 + hash = "sha256-CyPGiM/53duJc/oNtOsl6JSsl9uOOYm5R7O6YXaVOm4="; 20 26 }; 21 27 22 - buildInputs = [ 28 + buildInputs = [ setuptools ]; 29 + 30 + propagatedBuildInputs = [ 23 31 pyyaml 24 32 msgpack 25 33 pandas 34 + joblib 26 35 ]; 36 + 37 + doCheck = false; # Too many errors, not sure how to set this up properly 38 + 39 + nativeCheckInputs = [ 40 + pytestCheckHook 41 + filelock 42 + rocminfo 43 + ]; 44 + 45 + preCheck = '' 46 + export ROCM_PATH=${rocminfo} 47 + ''; 48 + 49 + pythonImportsCheck = [ "Tensile" ]; 27 50 28 51 passthru.updateScript = rocmUpdateScript { 29 52 name = pname;
+6 -3
pkgs/development/libraries/ucx/default.nix
··· 4 4 , enableCuda ? config.cudaSupport 5 5 , cudatoolkit 6 6 , enableRocm ? false 7 - , rocm-core, rocm-runtime, rocm-device-libs, hip 7 + , rocmPackages 8 8 }: 9 9 10 10 let ··· 13 13 inherit (cudatoolkit) name meta; 14 14 paths = [ cudatoolkit cudatoolkit.lib ]; 15 15 }; 16 + 17 + rocmList = with rocmPackages; [ rocm-core rocm-runtime rocm-device-libs clr ]; 18 + 16 19 rocm = symlinkJoin { 17 20 name = "rocm"; 18 - paths = [ rocm-core rocm-runtime rocm-device-libs hip ]; 21 + paths = rocmList; 19 22 }; 20 23 21 24 in ··· 40 43 rdma-core 41 44 zlib 42 45 ] ++ lib.optional enableCuda cudatoolkit 43 - ++ lib.optionals enableRocm [ rocm-core rocm-runtime rocm-device-libs hip ]; 46 + ++ lib.optionals enableRocm rocmList; 44 47 45 48 configureFlags = [ 46 49 "--with-rdmacm=${lib.getDev rdma-core}"
+44
pkgs/development/python-modules/barectf/default.nix
··· 1 + { lib 2 + , buildPythonPackage 3 + , fetchFromGitHub 4 + , poetry-core 5 + , pytestCheckHook 6 + , setuptools 7 + , jsonschema 8 + , pyyaml 9 + , jinja2 10 + , termcolor 11 + }: 12 + 13 + buildPythonPackage rec { 14 + pname = "barectf"; 15 + version = "3.1.2"; 16 + format = "pyproject"; 17 + 18 + src = fetchFromGitHub { 19 + owner = "efficios"; 20 + repo = "barectf"; 21 + rev = "v${version}"; 22 + hash = "sha256-JelFfd3WS012dveNlIljhLdyPmgE9VEOXoZE3MBA/Gw="; 23 + }; 24 + 25 + nativeBuildInputs = [ poetry-core ]; 26 + nativeCheckInputs = [ pytestCheckHook ]; 27 + 28 + propagatedBuildInputs = [ 29 + setuptools # needs pkg_resources at runtime 30 + jsonschema 31 + pyyaml 32 + jinja2 33 + termcolor 34 + ]; 35 + 36 + pythonImportsCheck = [ "barectf" ]; 37 + 38 + meta = with lib; { 39 + description = "Generator of ANSI C tracers which output CTF data streams "; 40 + homepage = "https://github.com/efficios/barectf"; 41 + license = licenses.mit; 42 + maintainers = with maintainers; [ Madouura ]; 43 + }; 44 + }
+2 -2
pkgs/development/python-modules/lit/default.nix
··· 6 6 7 7 buildPythonPackage rec { 8 8 pname = "lit"; 9 - version = "15.0.6"; 9 + version = "17.0.1"; 10 10 11 11 src = fetchPypi { 12 12 inherit pname version; 13 - hash = "sha256-S06OQfDmDyutls21HxyQ016ku3FTTsDOP8Di67d9f+k="; 13 + hash = "sha256-RIZ65Xa1eQVnsSC8Pw2fAh2slCTRsIQMdazYX0YQrAQ="; 14 14 }; 15 15 16 16 passthru = {
+75 -147
pkgs/development/python-modules/openai-triton/default.nix
··· 1 1 { lib 2 + , callPackage 2 3 , buildPythonPackage 3 - , python 4 - , fetchpatch 5 4 , fetchFromGitHub 6 5 , addOpenGLRunpath 6 + , pytestCheckHook 7 + , pythonRelaxDepsHook 8 + , pkgsTargetTarget 7 9 , cmake 8 - , cudaPackages 9 - , llvmPackages 10 + , ninja 10 11 , pybind11 11 12 , gtest 12 13 , zlib ··· 15 16 , lit 16 17 , filelock 17 18 , torchWithRocm 18 - , pytest 19 - , pytestCheckHook 20 - , pythonRelaxDepsHook 21 - , pkgsTargetTarget 19 + , python 20 + , cudaPackages 22 21 }: 23 22 24 23 let 25 - pname = "triton"; 26 - version = "2.0.0"; 27 - 28 - inherit (cudaPackages) cuda_cudart backendStdenv; 29 - 30 24 # A time may come we'll want to be cross-friendly 31 25 # 32 26 # Short explanation: we need pkgsTargetTarget, because we use string ··· 38 32 # pkgsTargetTarget maybe doesn't matter, because ptxas compiles programs to 39 33 # be executed on the GPU. 40 34 # Cf. https://nixos.org/manual/nixpkgs/unstable/#sec-cross-infra 41 - ptxas = "${pkgsTargetTarget.cudaPackages.cuda_nvcc}/bin/ptxas"; 42 - 43 - llvm = (llvmPackages.llvm.override { 44 - llvmTargetsToBuild = [ "NATIVE" "NVPTX" ]; 45 - # Upstream CI sets these too: 46 - # targetProjects = [ "mlir" ]; 47 - extraCMakeFlags = [ 48 - "-DLLVM_INSTALL_UTILS=ON" 49 - ]; 50 - }); 35 + ptxas = "${pkgsTargetTarget.cudaPackages.cuda_nvcc}/bin/ptxas"; # Make sure cudaPackages is the right version each update (See python/setup.py) 36 + llvm = callPackage ./llvm.nix { }; # Use a custom llvm, see llvm.nix for details 51 37 in 52 - buildPythonPackage { 53 - inherit pname version; 54 - 38 + buildPythonPackage rec { 39 + pname = "triton"; 40 + version = "2.0.0"; 55 41 format = "setuptools"; 56 42 57 43 src = fetchFromGitHub { ··· 62 48 }; 63 49 64 50 patches = [ 65 - # Prerequisite for llvm15 patch 66 - (fetchpatch { 67 - url = "https://github.com/openai/triton/commit/2aba985daaa70234823ea8f1161da938477d3e02.patch"; 68 - hash = "sha256-LGv0+Ut2WYPC4Ksi4803Hwmhi3FyQOF9zElJc/JCobk="; 69 - }) 70 - (fetchpatch { 71 - url = "https://github.com/openai/triton/commit/e3941f9d09cdd31529ba4a41018cfc0096aafea6.patch"; 72 - hash = "sha256-A+Gor6qzFlGQhVVhiaaYOzqqx8yO2MdssnQS6TIfUWg="; 73 - }) 74 - 75 - # Source: https://github.com/openai/triton/commit/fc7a8e35819bda632bdcf1cf75fd9abe4d4e077a.patch 76 - # The original patch adds ptxas binary, so we include our own clean copy 77 - # Drop with the next update 78 - ./llvm15.patch 79 - 80 51 # TODO: there have been commits upstream aimed at removing the "torch" 81 52 # circular dependency, but the patches fail to apply on the release 82 53 # revision. Keeping the link for future reference ··· 87 58 # hash = "sha256-f0shIqHJkVvuil2Yku7vuqWFn7VCRKFSFjYRlwx25ig="; 88 59 # }) 89 60 ]; 90 - 91 - postPatch = '' 92 - substituteInPlace python/setup.py \ 93 - --replace \ 94 - '= get_thirdparty_packages(triton_cache_path)' \ 95 - '= os.environ["cmakeFlags"].split()' 96 - '' 97 - # Wiring triton=2.0.0 with llcmPackages_rocm.llvm=5.4.3 98 - # Revisit when updating either triton or llvm 99 - + '' 100 - substituteInPlace CMakeLists.txt \ 101 - --replace "nvptx" "NVPTX" \ 102 - --replace "LLVM 11" "LLVM" 103 - sed -i '/AddMLIR/a set(MLIR_TABLEGEN_EXE "${llvmPackages.mlir}/bin/mlir-tblgen")' CMakeLists.txt 104 - sed -i '/AddMLIR/a set(MLIR_INCLUDE_DIR ''${MLIR_INCLUDE_DIRS})' CMakeLists.txt 105 - find -iname '*.td' -exec \ 106 - sed -i \ 107 - -e '\|include "mlir/IR/OpBase.td"|a include "mlir/IR/AttrTypeBase.td"' \ 108 - -e 's|include "mlir/Dialect/StandardOps/IR/Ops.td"|include "mlir/Dialect/Func/IR/FuncOps.td"|' \ 109 - '{}' ';' 110 - substituteInPlace unittest/CMakeLists.txt --replace "include(GoogleTest)" "find_package(GTest REQUIRED)" 111 - sed -i 's/^include.*$//' unittest/CMakeLists.txt 112 - sed -i '/LINK_LIBS/i NVPTXInfo' lib/Target/PTX/CMakeLists.txt 113 - sed -i '/LINK_LIBS/i NVPTXCodeGen' lib/Target/PTX/CMakeLists.txt 114 - '' 115 - # TritonMLIRIR already links MLIRIR. Not transitive? 116 - # + '' 117 - # echo "target_link_libraries(TritonPTX PUBLIC MLIRIR)" >> lib/Target/PTX/CMakeLists.txt 118 - # '' 119 - # Already defined in llvm, when built with -DLLVM_INSTALL_UTILS 120 - + '' 121 - substituteInPlace bin/CMakeLists.txt \ 122 - --replace "add_subdirectory(FileCheck)" "" 123 - 124 - rm cmake/FindLLVM.cmake 125 - '' 126 - + 127 - ( 128 - let 129 - # Bash was getting weird without linting, 130 - # but basically upstream contains [cc, ..., "-lcuda", ...] 131 - # and we replace it with [..., "-lcuda", "-L/run/opengl-driver/lib", "-L$stubs", ...] 132 - old = [ "-lcuda" ]; 133 - new = [ "-lcuda" "-L${addOpenGLRunpath.driverLink}" "-L${cuda_cudart}/lib/stubs/" ]; 134 - 135 - quote = x: ''"${x}"''; 136 - oldStr = lib.concatMapStringsSep ", " quote old; 137 - newStr = lib.concatMapStringsSep ", " quote new; 138 - in 139 - '' 140 - substituteInPlace python/triton/compiler.py \ 141 - --replace '${oldStr}' '${newStr}' 142 - '' 143 - ) 144 - # Triton seems to be looking up cuda.h 145 - + '' 146 - sed -i 's|cu_include_dir = os.path.join.*$|cu_include_dir = "${cuda_cudart}/include"|' python/triton/compiler.py 147 - ''; 148 61 149 62 nativeBuildInputs = [ 150 - cmake 151 63 pythonRelaxDepsHook 152 - 153 - # Requires torch (circular dependency) and probably needs GPUs: 154 - # pytestCheckHook 64 + # pytestCheckHook # Requires torch (circular dependency) and probably needs GPUs: 65 + cmake 66 + ninja 155 67 156 68 # Note for future: 157 69 # These *probably* should go in depsTargetTarget ··· 159 71 # because we only support cudaPackages on x86_64-linux atm 160 72 lit 161 73 llvm 162 - llvmPackages.mlir 163 74 ]; 164 75 165 76 buildInputs = [ ··· 170 81 zlib 171 82 ]; 172 83 173 - propagatedBuildInputs = [ 174 - filelock 175 - ]; 84 + propagatedBuildInputs = [ filelock ]; 85 + 86 + postPatch = let 87 + # Bash was getting weird without linting, 88 + # but basically upstream contains [cc, ..., "-lcuda", ...] 89 + # and we replace it with [..., "-lcuda", "-L/run/opengl-driver/lib", "-L$stubs", ...] 90 + old = [ "-lcuda" ]; 91 + new = [ "-lcuda" "-L${addOpenGLRunpath.driverLink}" "-L${cudaPackages.cuda_cudart}/lib/stubs/" ]; 92 + 93 + quote = x: ''"${x}"''; 94 + oldStr = lib.concatMapStringsSep ", " quote old; 95 + newStr = lib.concatMapStringsSep ", " quote new; 96 + in '' 97 + # Use our `cmakeFlags` instead and avoid downloading dependencies 98 + substituteInPlace python/setup.py \ 99 + --replace "= get_thirdparty_packages(triton_cache_path)" "= os.environ[\"cmakeFlags\"].split()" 100 + 101 + # Already defined in llvm, when built with -DLLVM_INSTALL_UTILS 102 + substituteInPlace bin/CMakeLists.txt \ 103 + --replace "add_subdirectory(FileCheck)" "" 104 + 105 + # Use our linker flags 106 + substituteInPlace python/triton/compiler.py \ 107 + --replace '${oldStr}' '${newStr}' 108 + 109 + # Don't fetch googletest 110 + substituteInPlace unittest/CMakeLists.txt \ 111 + --replace "include (\''${CMAKE_CURRENT_SOURCE_DIR}/googletest.cmake)" ""\ 112 + --replace "include(GoogleTest)" "find_package(GTest REQUIRED)" 113 + ''; 176 114 177 115 # Avoid GLIBCXX mismatch with other cuda-enabled python packages 178 116 preConfigure = '' 179 - export CC="${backendStdenv.cc}/bin/cc"; 180 - export CXX="${backendStdenv.cc}/bin/c++"; 117 + export CC=${cudaPackages.backendStdenv.cc}/bin/cc; 118 + export CXX=${cudaPackages.backendStdenv.cc}/bin/c++; 181 119 182 120 # Upstream's setup.py tries to write cache somewhere in ~/ 183 - export HOME=$TMPDIR 121 + export HOME=$(mktemp -d) 184 122 185 123 # Upstream's github actions patch setup.cfg to write base-dir. May be redundant 186 124 echo " ··· 188 126 base-dir=$PWD" >> python/setup.cfg 189 127 190 128 # The rest (including buildPhase) is relative to ./python/ 191 - cd python/ 129 + cd python 192 130 193 131 # Work around download_and_copy_ptxas() 194 - dst_cuda="$PWD/triton/third_party/cuda/bin" 195 - mkdir -p "$dst_cuda" 196 - ln -s "${ptxas}" "$dst_cuda/" 132 + mkdir -p $PWD/triton/third_party/cuda/bin 133 + ln -s ${ptxas} $PWD/triton/third_party/cuda/bin 197 134 ''; 198 135 199 136 # CMake is run by setup.py instead 200 137 dontUseCmakeConfigure = true; 201 - cmakeFlags = [ 202 - "-DMLIR_DIR=${llvmPackages.mlir}/lib/cmake/mlir" 203 - ]; 204 138 205 - postFixup = 206 - let 207 - ptxasDestination = "$out/${python.sitePackages}/triton/third_party/cuda/bin/ptxas"; 208 - in 209 - # Setuptools (?) strips runpath and +x flags. Let's just restore the symlink 210 - '' 211 - rm -f ${ptxasDestination} 212 - ln -s ${ptxas} ${ptxasDestination} 213 - ''; 139 + # Setuptools (?) strips runpath and +x flags. Let's just restore the symlink 140 + postFixup = '' 141 + rm -f $out/${python.sitePackages}/triton/third_party/cuda/bin/ptxas 142 + ln -s ${ptxas} $out/${python.sitePackages}/triton/third_party/cuda/bin/ptxas 143 + ''; 214 144 215 - checkInputs = [ 216 - cmake # ctest 217 - ]; 145 + checkInputs = [ cmake ]; # ctest 218 146 dontUseSetuptoolsCheck = true; 219 - preCheck = 147 + 148 + preCheck = '' 220 149 # build/temp* refers to build_ext.build_temp (looked up in the build logs) 221 - '' 222 - (cd /build/source/python/build/temp* ; ctest) 223 - '' # For pytestCheckHook 224 - + '' 225 - cd test/unit 226 - ''; 227 - pythonImportsCheck = [ 228 - # Circular dependency on torch 229 - # "triton" 230 - # "triton.language" 231 - ]; 150 + (cd /build/source/python/build/temp* ; ctest) 151 + 152 + # For pytestCheckHook 153 + cd test/unit 154 + ''; 155 + 156 + # Circular dependency on torch 157 + # pythonImportsCheck = [ 158 + # "triton" 159 + # "triton.language" 160 + # ]; 232 161 233 162 # Ultimately, torch is our test suite: 234 - passthru.tests = { 235 - inherit torchWithRocm; 236 - }; 163 + passthru.tests = { inherit torchWithRocm; }; 237 164 238 165 pythonRemoveDeps = [ 239 166 # Circular dependency, cf. https://github.com/openai/triton/issues/1374 ··· 243 170 "cmake" 244 171 "lit" 245 172 ]; 173 + 246 174 meta = with lib; { 247 - description = "Development repository for the Triton language and compiler"; 248 - homepage = "https://github.com/openai/triton/"; 175 + description = "Language and compiler for writing highly efficient custom Deep-Learning primitives"; 176 + homepage = "https://github.com/openai/triton"; 249 177 platforms = lib.platforms.unix; 250 178 license = licenses.mit; 251 - maintainers = with maintainers; [ SomeoneSerge ]; 179 + maintainers = with maintainers; [ SomeoneSerge Madouura ]; 252 180 }; 253 181 }
+112
pkgs/development/python-modules/openai-triton/llvm.nix
··· 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , pkg-config 5 + , cmake 6 + , ninja 7 + , git 8 + , doxygen 9 + , sphinx 10 + , libxml2 11 + , libxcrypt 12 + , libedit 13 + , libffi 14 + , mpfr 15 + , zlib 16 + , ncurses 17 + , python3Packages 18 + , buildDocs ? true 19 + , buildMan ? true 20 + , buildTests ? true 21 + }: 22 + 23 + stdenv.mkDerivation (finalAttrs: { 24 + pname = "triton-llvm"; 25 + version = "14.0.6-f28c006a5895"; 26 + 27 + outputs = [ 28 + "out" 29 + ] ++ lib.optionals buildDocs [ 30 + "doc" 31 + ] ++ lib.optionals buildMan [ 32 + "man" 33 + ]; 34 + 35 + # See https://github.com/openai/triton/blob/main/python/setup.py and https://github.com/ptillet/triton-llvm-releases/releases 36 + src = fetchFromGitHub { 37 + owner = "llvm"; 38 + repo = "llvm-project"; 39 + rev = "f28c006a5895fc0e329fe15fead81e37457cb1d1"; 40 + hash = "sha256-vffu4HilvYwtzwgq+NlS26m65DGbp6OSSne2aje1yJE="; 41 + }; 42 + 43 + nativeBuildInputs = [ 44 + pkg-config 45 + cmake 46 + ninja 47 + git 48 + python3Packages.python 49 + ] ++ lib.optionals (buildDocs || buildMan) [ 50 + doxygen 51 + sphinx 52 + python3Packages.recommonmark 53 + ]; 54 + 55 + buildInputs = [ 56 + libxml2 57 + libxcrypt 58 + libedit 59 + libffi 60 + mpfr 61 + ]; 62 + 63 + propagatedBuildInputs = [ 64 + zlib 65 + ncurses 66 + ]; 67 + 68 + sourceRoot = "${finalAttrs.src.name}/llvm"; 69 + 70 + cmakeFlags = [ 71 + "-DLLVM_TARGETS_TO_BUILD=X86;AMDGPU;NVPTX" 72 + "-DLLVM_ENABLE_PROJECTS=llvm;mlir" 73 + "-DLLVM_INSTALL_UTILS=ON" 74 + ] ++ lib.optionals (buildDocs || buildMan) [ 75 + "-DLLVM_INCLUDE_DOCS=ON" 76 + "-DMLIR_INCLUDE_DOCS=ON" 77 + "-DLLVM_BUILD_DOCS=ON" 78 + # "-DLLVM_ENABLE_DOXYGEN=ON" Way too slow, only uses one core 79 + "-DLLVM_ENABLE_SPHINX=ON" 80 + "-DSPHINX_OUTPUT_HTML=ON" 81 + "-DSPHINX_OUTPUT_MAN=ON" 82 + "-DSPHINX_WARNINGS_AS_ERRORS=OFF" 83 + ] ++ lib.optionals buildTests [ 84 + "-DLLVM_INCLUDE_TESTS=ON" 85 + "-DMLIR_INCLUDE_TESTS=ON" 86 + "-DLLVM_BUILD_TESTS=ON" 87 + ]; 88 + 89 + postPatch = '' 90 + # `CMake Error: cannot write to file "/build/source/llvm/build/lib/cmake/mlir/MLIRTargets.cmake": Permission denied` 91 + chmod +w -R ../mlir 92 + 93 + # FileSystem permissions tests fail with various special bits 94 + rm test/tools/llvm-objcopy/ELF/mirror-permissions-unix.test 95 + rm unittests/Support/Path.cpp 96 + 97 + substituteInPlace unittests/Support/CMakeLists.txt \ 98 + --replace "Path.cpp" "" 99 + ''; 100 + 101 + doCheck = buildTests; 102 + requiredSystemFeatures = [ "big-parallel" ]; 103 + 104 + meta = with lib; { 105 + description = "Collection of modular and reusable compiler and toolchain technologies"; 106 + homepage = "https://github.com/llvm/llvm-project"; 107 + license = with licenses; [ ncsa ]; 108 + maintainers = with maintainers; [ SomeoneSerge Madouura ]; 109 + platforms = platforms.linux; 110 + broken = stdenv.isAarch64; # https://github.com/RadeonOpenCompute/ROCm/issues/1831#issuecomment-1278205344 111 + }; 112 + })
-4617
pkgs/development/python-modules/openai-triton/llvm15.patch
··· 1 - From fc7a8e35819bda632bdcf1cf75fd9abe4d4e077a Mon Sep 17 00:00:00 2001 2 - From: Christian Sigg <chsigg@users.noreply.github.com> 3 - Date: Thu, 16 Feb 2023 15:40:53 +0100 4 - Subject: [PATCH] Rebase Triton to LLVM-15. (#1070) 5 - 6 - This PR rebases Triton from LLVM-14 to LLVM-15. Most changes are 7 - mechanical, except for the analysis framework changes. 8 - --- 9 - CMakeLists.txt | 6 +- 10 - bin/CMakeLists.txt | 2 +- 11 - bin/FileCheck/FileCheck.cpp | 3 + 12 - bin/triton-opt.cpp | 6 +- 13 - bin/triton-translate.cpp | 7 +- 14 - include/triton/Analysis/Alias.h | 21 +- 15 - include/triton/Analysis/Allocation.h | 2 + 16 - include/triton/Analysis/AxisInfo.h | 56 ++- 17 - include/triton/Analysis/Utility.h | 6 +- 18 - include/triton/Conversion/Passes.td | 4 +- 19 - include/triton/Dialect/Triton/IR/Dialect.h | 7 +- 20 - .../triton/Dialect/Triton/IR/TritonDialect.td | 8 +- 21 - include/triton/Dialect/Triton/IR/TritonOps.td | 12 +- 22 - .../triton/Dialect/Triton/IR/TritonTypes.td | 2 + 23 - .../Dialect/Triton/Transforms/Passes.td | 3 +- 24 - include/triton/Dialect/TritonGPU/IR/Dialect.h | 4 +- 25 - .../Dialect/TritonGPU/IR/TritonGPUAttrDefs.td | 7 + 26 - .../Dialect/TritonGPU/IR/TritonGPUDialect.td | 2 +- 27 - .../Dialect/TritonGPU/IR/TritonGPUOps.td | 13 +- 28 - lib/Analysis/Alias.cpp | 14 +- 29 - lib/Analysis/Allocation.cpp | 30 +- 30 - lib/Analysis/AxisInfo.cpp | 79 ++-- 31 - lib/Analysis/CMakeLists.txt | 2 +- 32 - lib/Analysis/Membar.cpp | 2 +- 33 - lib/Analysis/Utility.cpp | 54 +++ 34 - .../TritonGPUToLLVM/ConvertLayoutOpToLLVM.cpp | 3 - 35 - lib/Conversion/TritonGPUToLLVM/DotOpHelpers.h | 10 +- 36 - .../TritonGPUToLLVM/DotOpToLLVM.cpp | 5 - 37 - .../TritonGPUToLLVM/ElementwiseOpToLLVM.cpp | 2 - 38 - .../TritonGPUToLLVM/LoadStoreOpToLLVM.cpp | 5 +- 39 - .../TritonGPUToLLVM/ReduceOpToLLVM.cpp | 2 - 40 - .../TritonGPUToLLVM/TritonGPUToLLVM.cpp | 7 +- 41 - .../TritonGPUToLLVM/TritonGPUToLLVMBase.h | 26 +- 42 - .../TritonGPUToLLVM/TritonGPUToLLVMPass.cpp | 52 +-- 43 - lib/Conversion/TritonGPUToLLVM/Utility.h | 5 +- 44 - .../TritonToTritonGPUPass.cpp | 69 ++-- 45 - lib/Dialect/Triton/IR/CMakeLists.txt | 10 +- 46 - lib/Dialect/Triton/IR/Ops.cpp | 34 +- 47 - lib/Dialect/Triton/Transforms/Combine.cpp | 6 +- 48 - lib/Dialect/Triton/Transforms/Combine.td | 2 +- 49 - lib/Dialect/TritonGPU/IR/Dialect.cpp | 27 +- 50 - lib/Dialect/TritonGPU/Transforms/Coalesce.cpp | 20 +- 51 - lib/Dialect/TritonGPU/Transforms/Combine.cpp | 2 +- 52 - lib/Dialect/TritonGPU/Transforms/Combine.td | 1 + 53 - .../Transforms/DecomposeConversions.cpp | 2 +- 54 - lib/Dialect/TritonGPU/Transforms/Pipeline.cpp | 10 +- 55 - .../Transforms/ReorderInstructions.cpp | 2 +- 56 - .../Transforms/TritonGPUConversion.cpp | 12 +- 57 - .../Transforms/UpdateMmaForVolta.cpp | 6 +- 58 - lib/Dialect/TritonGPU/Transforms/Utility.cpp | 2 +- 59 - lib/Target/LLVMIR/CMakeLists.txt | 3 +- 60 - lib/Target/PTX/PTXTranslation.cpp | 3 + 61 - python/setup.py | 15 +- 62 - python/src/triton.cc | 85 +++-- 63 - python/test/unit/language/test_core.py | 2 +- 64 - python/triton/compiler.py | 4 +- 65 - test/Analysis/test-alias.mlir | 24 +- 66 - test/Analysis/test-alignment.mlir | 344 +++++++++--------- 67 - test/Analysis/test-allocation.mlir | 32 +- 68 - test/Analysis/test-membar.mlir | 38 +- 69 - test/Conversion/triton_ops.mlir | 10 +- 70 - test/Conversion/triton_to_tritongpu.mlir | 6 +- 71 - test/Conversion/tritongpu_to_llvm.mlir | 94 ++--- 72 - test/Target/tritongpu_to_llvmir.mlir | 4 +- 73 - test/Target/tritongpu_to_ptx.mlir | 2 +- 74 - test/Triton/combine.mlir | 40 +- 75 - test/Triton/vecadd.mlir | 4 +- 76 - test/TritonGPU/coalesce.mlir | 2 +- 77 - test/TritonGPU/combine.mlir | 38 +- 78 - test/TritonGPU/loop-pipeline.mlir | 22 +- 79 - test/TritonGPU/matmul.mlir | 4 +- 80 - test/TritonGPU/prefetch.mlir | 4 +- 81 - test/TritonGPU/update-mma-for-volta.mlir | 4 +- 82 - test/lib/Analysis/TestAlias.cpp | 29 +- 83 - test/lib/Analysis/TestAllocation.cpp | 5 +- 84 - test/lib/Analysis/TestAxisInfo.cpp | 51 +-- 85 - test/lib/Analysis/TestMembar.cpp | 7 +- 86 - 78 files changed, 808 insertions(+), 742 deletions(-) 87 - 88 - diff --git a/CMakeLists.txt b/CMakeLists.txt 89 - index d0d361fc7c..b281a28400 100644 90 - --- a/CMakeLists.txt 91 - +++ b/CMakeLists.txt 92 - @@ -1,4 +1,7 @@ 93 - cmake_minimum_required(VERSION 3.6) 94 - + 95 - +cmake_policy(SET CMP0116 OLD) 96 - + 97 - include(ExternalProject) 98 - 99 - set(CMAKE_CXX_STANDARD 17) 100 - @@ -155,7 +158,6 @@ if(TRITON_BUILD_PYTHON_MODULE) 101 - endif() 102 - endif() 103 - 104 - - 105 - # # Triton 106 - # file(GLOB_RECURSE LIBTRITON_SRC lib/*.cc) 107 - # if (WIN32 AND TRITON_BUILD_PYTHON_MODULE) 108 - @@ -212,7 +214,7 @@ if(TRITON_BUILD_PYTHON_MODULE) 109 - # optimizations 110 - MLIRPass 111 - MLIRTransforms 112 - - MLIRLLVMIR 113 - + MLIRLLVMDialect 114 - MLIRSupport 115 - MLIRTargetLLVMIRExport 116 - MLIRExecutionEngine 117 - diff --git a/bin/CMakeLists.txt b/bin/CMakeLists.txt 118 - index 906f635f8b..695b3479fd 100644 119 - --- a/bin/CMakeLists.txt 120 - +++ b/bin/CMakeLists.txt 121 - @@ -48,7 +48,7 @@ llvm_update_compile_flags(triton-translate) 122 - # MLIR core 123 - MLIROptLib 124 - MLIRIR 125 - - MLIRLLVMIR 126 - + MLIRLLVMDialect 127 - MLIRPass 128 - MLIRSupport 129 - MLIRTransforms 130 - diff --git a/bin/FileCheck/FileCheck.cpp b/bin/FileCheck/FileCheck.cpp 131 - index 819efc3541..9ac6f1b277 100644 132 - --- a/bin/FileCheck/FileCheck.cpp 133 - +++ b/bin/FileCheck/FileCheck.cpp 134 - @@ -19,6 +19,7 @@ 135 - #include "llvm/Support/CommandLine.h" 136 - #include "llvm/Support/InitLLVM.h" 137 - #include "llvm/Support/Process.h" 138 - +#include "llvm/Support/SourceMgr.h" 139 - #include "llvm/Support/WithColor.h" 140 - #include "llvm/Support/raw_ostream.h" 141 - #include <cmath> 142 - @@ -360,6 +361,8 @@ static std::string GetCheckTypeAbbreviation(Check::FileCheckType Ty) { 143 - return "bad-not"; 144 - case Check::CheckBadCount: 145 - return "bad-count"; 146 - + case Check::CheckMisspelled: 147 - + return "misspelled"; 148 - case Check::CheckNone: 149 - llvm_unreachable("invalid FileCheckType"); 150 - } 151 - diff --git a/bin/triton-opt.cpp b/bin/triton-opt.cpp 152 - index 9f3b53b7ae..f96232e1b0 100644 153 - --- a/bin/triton-opt.cpp 154 - +++ b/bin/triton-opt.cpp 155 - @@ -8,7 +8,7 @@ 156 - 157 - #include "mlir/IR/Dialect.h" 158 - #include "mlir/InitAllPasses.h" 159 - -#include "mlir/Support/MlirOptMain.h" 160 - +#include "mlir/Tools/mlir-opt/MlirOptMain.h" 161 - 162 - namespace mlir { 163 - namespace test { 164 - @@ -33,8 +33,8 @@ int main(int argc, char **argv) { 165 - // TODO: register Triton & TritonGPU passes 166 - mlir::DialectRegistry registry; 167 - registry.insert<mlir::triton::TritonDialect, 168 - - mlir::triton::gpu::TritonGPUDialect, mlir::math::MathDialect, 169 - - mlir::arith::ArithmeticDialect, mlir::StandardOpsDialect, 170 - + mlir::triton::gpu::TritonGPUDialect, mlir::func::FuncDialect, 171 - + mlir::math::MathDialect, mlir::arith::ArithmeticDialect, 172 - mlir::scf::SCFDialect, mlir::gpu::GPUDialect>(); 173 - 174 - return mlir::asMainReturnCode(mlir::MlirOptMain( 175 - diff --git a/bin/triton-translate.cpp b/bin/triton-translate.cpp 176 - index 05ba15e453..56b5d65857 100644 177 - --- a/bin/triton-translate.cpp 178 - +++ b/bin/triton-translate.cpp 179 - @@ -3,7 +3,7 @@ 180 - #include "mlir/IR/AsmState.h" 181 - #include "mlir/IR/BuiltinOps.h" 182 - #include "mlir/IR/Dialect.h" 183 - -#include "mlir/Parser.h" 184 - +#include "mlir/Parser/Parser.h" 185 - #include "mlir/Pass/Pass.h" 186 - #include "mlir/Pass/PassManager.h" 187 - #include "mlir/Support/FileUtilities.h" 188 - @@ -38,7 +38,7 @@ OwningOpRef<ModuleOp> loadMLIRModule(llvm::StringRef inputFilename, 189 - mlir::DialectRegistry registry; 190 - registry.insert<TritonDialect, triton::gpu::TritonGPUDialect, 191 - mlir::math::MathDialect, arith::ArithmeticDialect, 192 - - StandardOpsDialect, scf::SCFDialect>(); 193 - + scf::SCFDialect>(); 194 - 195 - context.appendDialectRegistry(registry); 196 - 197 - @@ -50,7 +50,8 @@ OwningOpRef<ModuleOp> loadMLIRModule(llvm::StringRef inputFilename, 198 - context.loadAllAvailableDialects(); 199 - context.allowUnregisteredDialects(); 200 - 201 - - OwningOpRef<ModuleOp> module(parseSourceFile(sourceMgr, &context)); 202 - + OwningOpRef<ModuleOp> module = 203 - + parseSourceFile<ModuleOp>(sourceMgr, &context); 204 - if (!module) { 205 - llvm::errs() << "Parse MLIR file failed."; 206 - return nullptr; 207 - diff --git a/include/triton/Analysis/Alias.h b/include/triton/Analysis/Alias.h 208 - index fa6b906fc9..631df518bc 100644 209 - --- a/include/triton/Analysis/Alias.h 210 - +++ b/include/triton/Analysis/Alias.h 211 - @@ -2,7 +2,7 @@ 212 - #define TRITON_ANALYSIS_ALIAS_H 213 - 214 - #include "mlir/Analysis/AliasAnalysis.h" 215 - -#include "mlir/Analysis/DataFlowAnalysis.h" 216 - +#include "mlir/Analysis/DataFlow/SparseAnalysis.h" 217 - #include "llvm/ADT/DenseSet.h" 218 - 219 - namespace mlir { 220 - @@ -21,7 +21,7 @@ class AliasInfo { 221 - } 222 - 223 - /// The pessimistic value state of a value without alias 224 - - static AliasInfo getPessimisticValueState(MLIRContext *context) { 225 - + static AliasInfo getPessimisticValueState(MLIRContext *context = nullptr) { 226 - return AliasInfo(); 227 - } 228 - static AliasInfo getPessimisticValueState(Value value) { return AliasInfo(); } 229 - @@ -29,6 +29,10 @@ class AliasInfo { 230 - /// The union of both arguments 231 - static AliasInfo join(const AliasInfo &lhs, const AliasInfo &rhs); 232 - 233 - + void print(raw_ostream &os) const { 234 - + llvm::interleaveComma(allocs, os, [&](Value alloc) { alloc.print(os); }); 235 - + } 236 - + 237 - private: 238 - /// The set of allocated values that are aliased by this lattice. 239 - /// For now, we only consider aliased value produced by the following 240 - @@ -58,9 +62,13 @@ class AliasInfo { 241 - //===----------------------------------------------------------------------===// 242 - // Shared Memory Alias Analysis 243 - //===----------------------------------------------------------------------===// 244 - -class SharedMemoryAliasAnalysis : public ForwardDataFlowAnalysis<AliasInfo> { 245 - +class SharedMemoryAliasAnalysis 246 - + : public dataflow::SparseDataFlowAnalysis<dataflow::Lattice<AliasInfo>> { 247 - public: 248 - - using ForwardDataFlowAnalysis<AliasInfo>::ForwardDataFlowAnalysis; 249 - + using dataflow::SparseDataFlowAnalysis< 250 - + dataflow::Lattice<AliasInfo>>::SparseDataFlowAnalysis; 251 - + using dataflow::SparseDataFlowAnalysis< 252 - + dataflow::Lattice<AliasInfo>>::getLatticeElement; 253 - 254 - /// XXX(Keren): Compatible interface with MLIR AliasAnalysis for future use. 255 - /// Given two values, returns their aliasing behavior. 256 - @@ -70,9 +78,10 @@ class SharedMemoryAliasAnalysis : public ForwardDataFlowAnalysis<AliasInfo> { 257 - ModRefResult getModRef(Operation *op, Value location); 258 - 259 - /// Computes if the alloc set of the results are changed. 260 - - ChangeResult 261 - + void 262 - visitOperation(Operation *op, 263 - - ArrayRef<LatticeElement<AliasInfo> *> operands) override; 264 - + ArrayRef<const dataflow::Lattice<AliasInfo> *> operands, 265 - + ArrayRef<dataflow::Lattice<AliasInfo> *> results) override; 266 - }; 267 - 268 - } // namespace mlir 269 - diff --git a/include/triton/Analysis/Allocation.h b/include/triton/Analysis/Allocation.h 270 - index b7c136d602..89b77034cc 100644 271 - --- a/include/triton/Analysis/Allocation.h 272 - +++ b/include/triton/Analysis/Allocation.h 273 - @@ -188,6 +188,8 @@ class Allocation { 274 - friend class triton::AllocationAnalysis; 275 - }; 276 - 277 - +template <typename T> Interval(T, T) -> Interval<T>; 278 - + 279 - } // namespace mlir 280 - 281 - #endif // TRITON_ANALYSIS_ALLOCATION_H 282 - diff --git a/include/triton/Analysis/AxisInfo.h b/include/triton/Analysis/AxisInfo.h 283 - index fdfbd8fbb3..7083b9c43b 100644 284 - --- a/include/triton/Analysis/AxisInfo.h 285 - +++ b/include/triton/Analysis/AxisInfo.h 286 - @@ -1,9 +1,10 @@ 287 - #ifndef TRITON_ANALYSIS_AXISINFO_H 288 - #define TRITON_ANALYSIS_AXISINFO_H 289 - 290 - -#include "mlir/Analysis/DataFlowAnalysis.h" 291 - +#include "mlir/Analysis/DataFlow/SparseAnalysis.h" 292 - #include "llvm/Support/raw_ostream.h" 293 - 294 - +#include "mlir/Support/LLVM.h" 295 - #include "triton/Analysis/Utility.h" 296 - #include "triton/Dialect/Triton/IR/Dialect.h" 297 - #include "triton/Dialect/TritonGPU/IR/Dialect.h" 298 - @@ -62,7 +63,7 @@ class AxisInfo { 299 - } 300 - 301 - /// The pessimistic value state of the contiguity is unknown. 302 - - static AxisInfo getPessimisticValueState(MLIRContext *context) { 303 - + static AxisInfo getPessimisticValueState(MLIRContext *context = nullptr) { 304 - return AxisInfo(); 305 - } 306 - static AxisInfo getPessimisticValueState(Value value); 307 - @@ -70,6 +71,22 @@ class AxisInfo { 308 - /// The gcd of both arguments for each dimension 309 - static AxisInfo join(const AxisInfo &lhs, const AxisInfo &rhs); 310 - 311 - + void print(raw_ostream &os) const { 312 - + auto print = [&](StringRef name, DimVectorT vec) { 313 - + os << name << " = ["; 314 - + llvm::interleaveComma(vec, os); 315 - + os << "]"; 316 - + }; 317 - + print("contiguity", contiguity); 318 - + print(", divisibility", divisibility); 319 - + print(", constancy", constancy); 320 - + os << ", constant_value = "; 321 - + if (constantValue) 322 - + os << *constantValue; 323 - + else 324 - + os << "<none>"; 325 - + } 326 - + 327 - private: 328 - /// The _contiguity_ information maps the `d`-th 329 - /// dimension to the length of the shortest 330 - @@ -147,7 +164,8 @@ class AxisInfoVisitor { 331 - } 332 - 333 - virtual AxisInfo 334 - - getAxisInfo(Operation *op, ArrayRef<LatticeElement<AxisInfo> *> operands) = 0; 335 - + getAxisInfo(Operation *op, 336 - + ArrayRef<const dataflow::Lattice<AxisInfo> *> operands) = 0; 337 - 338 - virtual bool match(Operation *op) = 0; 339 - }; 340 - @@ -157,15 +175,16 @@ template <typename OpTy> class AxisInfoVisitorImpl : public AxisInfoVisitor { 341 - public: 342 - using AxisInfoVisitor::AxisInfoVisitor; 343 - 344 - - AxisInfo getAxisInfo(Operation *op, 345 - - ArrayRef<LatticeElement<AxisInfo> *> operands) final { 346 - + AxisInfo 347 - + getAxisInfo(Operation *op, 348 - + ArrayRef<const dataflow::Lattice<AxisInfo> *> operands) final { 349 - return getAxisInfo(cast<OpTy>(op), operands); 350 - } 351 - 352 - bool match(Operation *op) final { return isa<OpTy>(op); } 353 - 354 - - virtual AxisInfo getAxisInfo(OpTy op, 355 - - ArrayRef<LatticeElement<AxisInfo> *> operands) { 356 - + virtual AxisInfo 357 - + getAxisInfo(OpTy op, ArrayRef<const dataflow::Lattice<AxisInfo> *> operands) { 358 - llvm_unreachable("Unimplemented getAxisInfo"); 359 - } 360 - }; 361 - @@ -176,8 +195,9 @@ class BinaryOpVisitorImpl : public AxisInfoVisitorImpl<OpTy> { 362 - public: 363 - using AxisInfoVisitorImpl<OpTy>::AxisInfoVisitorImpl; 364 - 365 - - AxisInfo getAxisInfo(OpTy op, 366 - - ArrayRef<LatticeElement<AxisInfo> *> operands) override { 367 - + AxisInfo 368 - + getAxisInfo(OpTy op, 369 - + ArrayRef<const dataflow::Lattice<AxisInfo> *> operands) override { 370 - auto lhsInfo = operands[0]->getValue(); 371 - auto rhsInfo = operands[1]->getValue(); 372 - auto rank = lhsInfo.getRank(); 373 - @@ -230,7 +250,8 @@ class AxisInfoVisitorList { 374 - (visitors.emplace_back(std::make_unique<Ts>()), ...); 375 - } 376 - 377 - - AxisInfo apply(Operation *op, ArrayRef<LatticeElement<AxisInfo> *> operands) { 378 - + AxisInfo apply(Operation *op, 379 - + ArrayRef<const dataflow::Lattice<AxisInfo> *> operands) { 380 - for (auto &visitor : visitors) 381 - if (visitor->match(op)) 382 - return visitor->getAxisInfo(op, operands); 383 - @@ -241,16 +262,19 @@ class AxisInfoVisitorList { 384 - std::vector<std::unique_ptr<AxisInfoVisitor>> visitors; 385 - }; 386 - 387 - -class AxisInfoAnalysis : public ForwardDataFlowAnalysis<AxisInfo> { 388 - +class AxisInfoAnalysis 389 - + : public dataflow::SparseDataFlowAnalysis<dataflow::Lattice<AxisInfo>> { 390 - private: 391 - AxisInfoVisitorList visitors; 392 - 393 - public: 394 - - AxisInfoAnalysis(MLIRContext *context); 395 - + AxisInfoAnalysis(DataFlowSolver &solver); 396 - + using dataflow::SparseDataFlowAnalysis< 397 - + dataflow::Lattice<AxisInfo>>::getLatticeElement; 398 - 399 - - ChangeResult 400 - - visitOperation(Operation *op, 401 - - ArrayRef<LatticeElement<AxisInfo> *> operands) override; 402 - + void visitOperation(Operation *op, 403 - + ArrayRef<const dataflow::Lattice<AxisInfo> *> operands, 404 - + ArrayRef<dataflow::Lattice<AxisInfo> *> results) override; 405 - 406 - unsigned getPtrContiguity(Value ptr); 407 - 408 - @@ -261,4 +285,4 @@ class AxisInfoAnalysis : public ForwardDataFlowAnalysis<AxisInfo> { 409 - 410 - } // namespace mlir 411 - 412 - -#endif 413 - \ No newline at end of file 414 - +#endif 415 - diff --git a/include/triton/Analysis/Utility.h b/include/triton/Analysis/Utility.h 416 - index c5ac137dc1..ee7fadb59d 100644 417 - --- a/include/triton/Analysis/Utility.h 418 - +++ b/include/triton/Analysis/Utility.h 419 - @@ -1,6 +1,7 @@ 420 - #ifndef TRITON_ANALYSIS_UTILITY_H 421 - #define TRITON_ANALYSIS_UTILITY_H 422 - 423 - +#include "mlir/Analysis/DataFlowFramework.h" 424 - #include "mlir/Analysis/SliceAnalysis.h" 425 - #include "triton/Dialect/TritonGPU/IR/Dialect.h" 426 - #include <algorithm> 427 - @@ -12,7 +13,7 @@ namespace mlir { 428 - class ReduceOpHelper { 429 - public: 430 - explicit ReduceOpHelper(triton::ReduceOp op) : op(op) { 431 - - srcTy = op.operand().getType().cast<RankedTensorType>(); 432 - + srcTy = op.getOperand().getType().cast<RankedTensorType>(); 433 - } 434 - 435 - ArrayRef<int64_t> getSrcShape() { return srcTy.getShape(); } 436 - @@ -103,6 +104,9 @@ SetVector<Operation *> 437 - multiRootGetSlice(Operation *op, TransitiveFilter backwardFilter = nullptr, 438 - TransitiveFilter forwardFilter = nullptr); 439 - 440 - +// Create a basic DataFlowSolver with constant and dead code analysis included. 441 - +std::unique_ptr<DataFlowSolver> createDataFlowSolver(); 442 - + 443 - } // namespace mlir 444 - 445 - #endif // TRITON_ANALYSIS_UTILITY_H 446 - diff --git a/include/triton/Conversion/Passes.td b/include/triton/Conversion/Passes.td 447 - index 70bb20b78e..be00eb2dac 100644 448 - --- a/include/triton/Conversion/Passes.td 449 - +++ b/include/triton/Conversion/Passes.td 450 - @@ -12,7 +12,6 @@ def ConvertTritonToTritonGPU: Pass<"convert-triton-to-tritongpu", "mlir::ModuleO 451 - 452 - let dependentDialects = ["mlir::arith::ArithmeticDialect", 453 - "mlir::math::MathDialect", 454 - - "mlir::StandardOpsDialect", 455 - // TODO: Does this pass depend on SCF? 456 - "mlir::scf::SCFDialect", 457 - "mlir::triton::TritonDialect", 458 - @@ -41,8 +40,7 @@ def ConvertTritonGPUToLLVM : Pass<"convert-triton-gpu-to-llvm", "mlir::ModuleOp" 459 - "mlir::tensor::TensorDialect", 460 - "mlir::triton::TritonDialect", 461 - "mlir::triton::gpu::TritonGPUDialect", 462 - - "mlir::NVVM::NVVMDialect", 463 - - "mlir::StandardOpsDialect"]; 464 - + "mlir::NVVM::NVVMDialect"]; 465 - 466 - let options = [ 467 - Option<"computeCapability", "compute-capability", 468 - diff --git a/include/triton/Dialect/Triton/IR/Dialect.h b/include/triton/Dialect/Triton/IR/Dialect.h 469 - index e8012a51df..15869e262e 100644 470 - --- a/include/triton/Dialect/Triton/IR/Dialect.h 471 - +++ b/include/triton/Dialect/Triton/IR/Dialect.h 472 - @@ -1,14 +1,15 @@ 473 - #ifndef TRITON_DIALECT_TRITON_IR_DIALECT_H_ 474 - #define TRITON_DIALECT_TRITON_IR_DIALECT_H_ 475 - 476 - +#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h" 477 - +#include "mlir/Dialect/ControlFlow/IR/ControlFlow.h" 478 - +#include "mlir/Dialect/Func/IR/FuncOps.h" 479 - #include "mlir/Dialect/Math/IR/Math.h" 480 - -#include "mlir/Dialect/SCF/SCF.h" 481 - -#include "mlir/Dialect/StandardOps/IR/Ops.h" 482 - +#include "mlir/Dialect/SCF/IR/SCF.h" 483 - #include "mlir/Dialect/Tensor/IR/Tensor.h" 484 - #include "mlir/IR/BuiltinOps.h" 485 - #include "mlir/IR/Dialect.h" 486 - #include "mlir/Interfaces/ControlFlowInterfaces.h" 487 - - 488 - #include "triton/Dialect/Triton/IR/Dialect.h.inc" 489 - #include "triton/Dialect/Triton/IR/OpsEnums.h.inc" 490 - #include "triton/Dialect/Triton/IR/Traits.h" 491 - diff --git a/include/triton/Dialect/Triton/IR/TritonDialect.td b/include/triton/Dialect/Triton/IR/TritonDialect.td 492 - index 07b069e14f..d98ce73884 100644 493 - --- a/include/triton/Dialect/Triton/IR/TritonDialect.td 494 - +++ b/include/triton/Dialect/Triton/IR/TritonDialect.td 495 - @@ -25,12 +25,9 @@ def Triton_Dialect : Dialect { 496 - let dependentDialects = [ 497 - "arith::ArithmeticDialect", 498 - "math::MathDialect", 499 - - "StandardOpsDialect", 500 - "scf::SCFDialect", 501 - - 502 - - // Since LLVM 15 503 - - // "cf::ControlFlowDialect", 504 - - // "func::FuncDialect" 505 - + "cf::ControlFlowDialect", 506 - + "func::FuncDialect" 507 - ]; 508 - 509 - let extraClassDeclaration = [{ 510 - @@ -38,6 +35,7 @@ def Triton_Dialect : Dialect { 511 - }]; 512 - 513 - let hasConstantMaterializer = 1; 514 - + let useDefaultTypePrinterParser = 1; 515 - } 516 - 517 - include "triton/Dialect/Triton/IR/TritonTypes.td" 518 - diff --git a/include/triton/Dialect/Triton/IR/TritonOps.td b/include/triton/Dialect/Triton/IR/TritonOps.td 519 - index 779e0b648c..0a69211179 100644 520 - --- a/include/triton/Dialect/Triton/IR/TritonOps.td 521 - +++ b/include/triton/Dialect/Triton/IR/TritonOps.td 522 - @@ -141,11 +141,7 @@ def TT_LoadOp : TT_Op<"load", 523 - "triton::EvictionPolicy":$evict, "bool":$isVolatile)>, 524 - ]; 525 - 526 - - // let assemblyFormat = "operands attr-dict `:` type($result)"; 527 - - let parser = [{ return mlir::triton::parseLoadOp(parser, result); }]; 528 - - 529 - - let printer = [{ return mlir::triton::printLoadOp(p, *this); }]; 530 - - 531 - + let hasCustomAssemblyFormat = 1; 532 - let hasCanonicalizer = 1; 533 - } 534 - 535 - @@ -170,11 +166,7 @@ def TT_StoreOp : TT_Op<"store", 536 - "triton::EvictionPolicy":$evict)>, 537 - ]; 538 - 539 - - // let assemblyFormat = "operands attr-dict `:` type($value)"; 540 - - let parser = [{ return mlir::triton::parseStoreOp(parser, result); }]; 541 - - 542 - - let printer = [{ return mlir::triton::printStoreOp(p, *this); }]; 543 - - 544 - + let hasCustomAssemblyFormat = 1; 545 - let hasCanonicalizer = 1; 546 - } 547 - 548 - diff --git a/include/triton/Dialect/Triton/IR/TritonTypes.td b/include/triton/Dialect/Triton/IR/TritonTypes.td 549 - index 66d2a7b9a9..2fe2fd077d 100644 550 - --- a/include/triton/Dialect/Triton/IR/TritonTypes.td 551 - +++ b/include/triton/Dialect/Triton/IR/TritonTypes.td 552 - @@ -1,6 +1,7 @@ 553 - #ifndef TRITON_TYPES 554 - #define TRITON_TYPES 555 - 556 - +include "mlir/IR/AttrTypeBase.td" 557 - include "triton/Dialect/Triton/IR/TritonDialect.td" 558 - 559 - // 560 - @@ -58,6 +59,7 @@ def TT_Ptr : TritonTypeDef<"Pointer", "ptr"> { 561 - }]> 562 - ]; 563 - 564 - + let hasCustomAssemblyFormat = 1; 565 - let skipDefaultBuilders = 1; 566 - } 567 - def TT_PtrTensor : TensorOf<[TT_Ptr]>; 568 - diff --git a/include/triton/Dialect/Triton/Transforms/Passes.td b/include/triton/Dialect/Triton/Transforms/Passes.td 569 - index 8f77aed774..a25cdc5680 100644 570 - --- a/include/triton/Dialect/Triton/Transforms/Passes.td 571 - +++ b/include/triton/Dialect/Triton/Transforms/Passes.td 572 - @@ -16,8 +16,7 @@ def TritonCombineOps : Pass</*cli-arg*/"triton-combine", /*Op*/"mlir::ModuleOp"> 573 - 574 - let constructor = "mlir::triton::createCombineOpsPass()"; 575 - 576 - - let dependentDialects = ["mlir::arith::ArithmeticDialect", 577 - - /*SelectOp*/"mlir::StandardOpsDialect"]; 578 - + let dependentDialects = ["mlir::arith::ArithmeticDialect"]; 579 - } 580 - 581 - #endif 582 - diff --git a/include/triton/Dialect/TritonGPU/IR/Dialect.h b/include/triton/Dialect/TritonGPU/IR/Dialect.h 583 - index b4c8daec7b..dfc5f53ab1 100644 584 - --- a/include/triton/Dialect/TritonGPU/IR/Dialect.h 585 - +++ b/include/triton/Dialect/TritonGPU/IR/Dialect.h 586 - @@ -1,19 +1,17 @@ 587 - #ifndef TRITON_DIALECT_TRITONGPU_IR_DIALECT_H_ 588 - #define TRITON_DIALECT_TRITONGPU_IR_DIALECT_H_ 589 - 590 - -#include "mlir/Dialect/GPU/GPUDialect.h" 591 - +#include "mlir/Dialect/GPU/IR/GPUDialect.h" 592 - #include "mlir/Dialect/Tensor/IR/Tensor.h" 593 - #include "mlir/IR/BuiltinOps.h" 594 - #include "mlir/IR/Dialect.h" 595 - 596 - // TritonGPU depends on Triton 597 - #include "triton/Dialect/Triton/IR/Dialect.h" 598 - - 599 - #include "triton/Dialect/TritonGPU/IR/Dialect.h.inc" 600 - #include "triton/Dialect/TritonGPU/IR/Traits.h" 601 - 602 - #define GET_ATTRDEF_CLASSES 603 - -#include "triton/Dialect/Triton/IR/AttrInterfaces.h.inc" 604 - #include "triton/Dialect/TritonGPU/IR/TritonGPUAttrDefs.h.inc" 605 - 606 - #define GET_OP_CLASSES 607 - diff --git a/include/triton/Dialect/TritonGPU/IR/TritonGPUAttrDefs.td b/include/triton/Dialect/TritonGPU/IR/TritonGPUAttrDefs.td 608 - index 0242c3cc17..af2aeb03a8 100644 609 - --- a/include/triton/Dialect/TritonGPU/IR/TritonGPUAttrDefs.td 610 - +++ b/include/triton/Dialect/TritonGPU/IR/TritonGPUAttrDefs.td 611 - @@ -1,6 +1,7 @@ 612 - #ifndef TRITONGPU_ATTRDEFS 613 - #define TRITONGPU_ATTRDEFS 614 - 615 - +include "mlir/IR/AttrTypeBase.td" 616 - include "triton/Dialect/TritonGPU/IR/TritonGPUDialect.td" 617 - include "triton/Dialect/Triton/IR/TritonInterfaces.td" 618 - 619 - @@ -136,6 +137,7 @@ A_{3, 2} A_{3, 3} A_{3, 0} A_{3, 1} ... [phase 1] / 620 - ]; 621 - 622 - let extraClassDeclaration = extraBaseClassDeclaration; 623 - + let hasCustomAssemblyFormat = 1; 624 - } 625 - 626 - //===----------------------------------------------------------------------===// 627 - @@ -273,6 +275,7 @@ for 628 - // ArrayRefParameter<"unsigned">:$sizePerCTA 629 - ); 630 - 631 - + let hasCustomAssemblyFormat = 1; 632 - } 633 - 634 - //===----------------------------------------------------------------------===// 635 - @@ -422,6 +425,7 @@ For example, the matrix L corresponding to blockTileSize=[32,16] is: 636 - static constexpr int numBitsToHoldMmaV1ID{5}; 637 - }]; 638 - 639 - + let hasCustomAssemblyFormat = 1; 640 - } 641 - 642 - def SliceEncodingAttr : DistributedEncoding<"SliceEncoding"> { 643 - @@ -456,6 +460,8 @@ def SliceEncodingAttr : DistributedEncoding<"SliceEncoding"> { 644 - template<class T> 645 - SmallVector<T> paddedShape(ArrayRef<T> shape) const; 646 - }]; 647 - + 648 - + let hasCustomAssemblyFormat = 1; 649 - } 650 - 651 - def DotOperandEncodingAttr : DistributedEncoding<"DotOperandEncoding"> { 652 - @@ -492,6 +498,7 @@ section 9.7.13.4.1 for more details. 653 - 654 - ]; 655 - 656 - + let hasCustomAssemblyFormat = 1; 657 - let extraClassDeclaration = extraBaseClassDeclaration; 658 - } 659 - 660 - diff --git a/include/triton/Dialect/TritonGPU/IR/TritonGPUDialect.td b/include/triton/Dialect/TritonGPU/IR/TritonGPUDialect.td 661 - index 87ec1d36c6..6489a721b4 100644 662 - --- a/include/triton/Dialect/TritonGPU/IR/TritonGPUDialect.td 663 - +++ b/include/triton/Dialect/TritonGPU/IR/TritonGPUDialect.td 664 - @@ -30,7 +30,7 @@ def TritonGPU_Dialect : Dialect { 665 - } 666 - }]; 667 - 668 - - 669 - + let useDefaultAttributePrinterParser = 1; 670 - } 671 - 672 - #endif 673 - diff --git a/include/triton/Dialect/TritonGPU/IR/TritonGPUOps.td b/include/triton/Dialect/TritonGPU/IR/TritonGPUOps.td 674 - index 510f8d0183..7aba11dc75 100644 675 - --- a/include/triton/Dialect/TritonGPU/IR/TritonGPUOps.td 676 - +++ b/include/triton/Dialect/TritonGPU/IR/TritonGPUOps.td 677 - @@ -59,7 +59,7 @@ def TTG_AsyncCommitGroupOp : TTG_Op<"async_commit_group"> { 678 - // This is needed because these ops don't 679 - // handle encodings 680 - // e.g., https://github.com/llvm/llvm-project/blob/main/mlir/include/mlir/Dialect/Arith/IR/ArithOps.td#L111 681 - -def TTG_CmpIOp : TTG_Op<"cmpi", [NoSideEffect, Elementwise, 682 - +def TTG_CmpIOp : TTG_Op<"cmpi", [NoSideEffect, Elementwise, 683 - SameOperandsAndResultShape, 684 - SameOperandsAndResultEncoding]> { 685 - let summary = "integer comparison operation"; 686 - @@ -73,7 +73,7 @@ def TTG_CmpIOp : TTG_Op<"cmpi", [NoSideEffect, Elementwise, 687 - let results = (outs TT_BoolLike:$result); 688 - } 689 - 690 - -def TTG_CmpFOp : TTG_Op<"cmpf", [NoSideEffect, Elementwise, 691 - +def TTG_CmpFOp : TTG_Op<"cmpf", [NoSideEffect, Elementwise, 692 - SameOperandsAndResultShape, 693 - SameOperandsAndResultEncoding]> { 694 - let summary = "floating-point comparison operation"; 695 - @@ -88,8 +88,8 @@ def TTG_CmpFOp : TTG_Op<"cmpf", [NoSideEffect, Elementwise, 696 - } 697 - 698 - // TODO: migrate to arith::SelectOp on LLVM16 699 - -def TTG_SelectOp : TTG_Op<"select", [NoSideEffect, Elementwise, 700 - - SameOperandsAndResultShape, 701 - +def TTG_SelectOp : TTG_Op<"select", [NoSideEffect, Elementwise, 702 - + SameOperandsAndResultShape, 703 - SameOperandsAndResultEncoding]> { 704 - let summary = "select operation"; 705 - 706 - @@ -188,10 +188,7 @@ def TTG_InsertSliceAsyncOp : TTG_Op<"insert_slice_async", 707 - } 708 - }]; 709 - 710 - - // The custom parser could be replaced with oilist in LLVM-16 711 - - let parser = [{ return parseInsertSliceAsyncOp(parser, result); }]; 712 - - 713 - - let printer = [{ return printInsertSliceAsyncOp(p, *this); }]; 714 - + let hasCustomAssemblyFormat = 1; 715 - } 716 - 717 - def TTG_AllocTensorOp : TTG_Op<"alloc_tensor", [MemoryEffects<[MemAlloc]>, // Allocate shared memory 718 - diff --git a/lib/Analysis/Alias.cpp b/lib/Analysis/Alias.cpp 719 - index a39e4de9aa..208fdd4afc 100644 720 - --- a/lib/Analysis/Alias.cpp 721 - +++ b/lib/Analysis/Alias.cpp 722 - @@ -18,8 +18,9 @@ AliasInfo AliasInfo::join(const AliasInfo &lhs, const AliasInfo &rhs) { 723 - return ret; 724 - } 725 - 726 - -ChangeResult SharedMemoryAliasAnalysis::visitOperation( 727 - - Operation *op, ArrayRef<LatticeElement<AliasInfo> *> operands) { 728 - +void SharedMemoryAliasAnalysis::visitOperation( 729 - + Operation *op, ArrayRef<const dataflow::Lattice<AliasInfo> *> operands, 730 - + ArrayRef<dataflow::Lattice<AliasInfo> *> results) { 731 - AliasInfo aliasInfo; 732 - bool pessimistic = true; 733 - if (maybeSharedAllocationOp(op)) { 734 - @@ -44,14 +45,11 @@ ChangeResult SharedMemoryAliasAnalysis::visitOperation( 735 - } 736 - 737 - if (pessimistic) { 738 - - return markAllPessimisticFixpoint(op->getResults()); 739 - + return markAllPessimisticFixpoint(results); 740 - } 741 - // Join all lattice elements 742 - - ChangeResult result = ChangeResult::NoChange; 743 - - for (Value value : op->getResults()) { 744 - - result |= getLatticeElement(value).join(aliasInfo); 745 - - } 746 - - return result; 747 - + for (auto *result : results) 748 - + propagateIfChanged(result, result->join(aliasInfo)); 749 - } 750 - 751 - AliasResult SharedMemoryAliasAnalysis::alias(Value lhs, Value rhs) { 752 - diff --git a/lib/Analysis/Allocation.cpp b/lib/Analysis/Allocation.cpp 753 - index 712c08c475..b4de8dcd9d 100644 754 - --- a/lib/Analysis/Allocation.cpp 755 - +++ b/lib/Analysis/Allocation.cpp 756 - @@ -1,4 +1,5 @@ 757 - #include "triton/Analysis/Allocation.h" 758 - +#include "mlir/Analysis/DataFlowFramework.h" 759 - #include "mlir/Analysis/Liveness.h" 760 - #include "mlir/Analysis/SliceAnalysis.h" 761 - #include "mlir/Dialect/Tensor/IR/Tensor.h" 762 - @@ -33,10 +34,8 @@ constexpr int kPtrBitWidth = 64; 763 - 764 - static std::pair<SmallVector<unsigned>, SmallVector<unsigned>> 765 - getCvtOrder(const Attribute &srcLayout, const Attribute &dstLayout) { 766 - - auto srcBlockedLayout = srcLayout.dyn_cast<BlockedEncodingAttr>(); 767 - auto srcMmaLayout = srcLayout.dyn_cast<MmaEncodingAttr>(); 768 - auto srcDotLayout = srcLayout.dyn_cast<DotOperandEncodingAttr>(); 769 - - auto dstBlockedLayout = dstLayout.dyn_cast<BlockedEncodingAttr>(); 770 - auto dstMmaLayout = dstLayout.dyn_cast<MmaEncodingAttr>(); 771 - auto dstDotLayout = dstLayout.dyn_cast<DotOperandEncodingAttr>(); 772 - assert(!(srcMmaLayout && dstMmaLayout) && 773 - @@ -224,14 +223,12 @@ class AllocationAnalysis { 774 - } 775 - 776 - void getValueAlias(Value value, SharedMemoryAliasAnalysis &analysis) { 777 - - LatticeElement<AliasInfo> *latticeElement = 778 - - analysis.lookupLatticeElement(value); 779 - - if (latticeElement) { 780 - - auto &info = latticeElement->getValue(); 781 - - if (!info.getAllocs().empty()) { 782 - - for (auto alloc : info.getAllocs()) { 783 - - allocation->addAlias(value, alloc); 784 - - } 785 - + dataflow::Lattice<AliasInfo> *latticeElement = 786 - + analysis.getLatticeElement(value); 787 - + if (latticeElement && !latticeElement->isUninitialized()) { 788 - + AliasInfo &info = latticeElement->getValue(); 789 - + for (auto alloc : info.getAllocs()) { 790 - + allocation->addAlias(value, alloc); 791 - } 792 - } 793 - } 794 - @@ -244,14 +241,19 @@ class AllocationAnalysis { 795 - getScratchValueSize(op); 796 - }); 797 - // Get the alias values 798 - - SharedMemoryAliasAnalysis aliasAnalysis(operation->getContext()); 799 - - aliasAnalysis.run(operation); 800 - + std::unique_ptr<DataFlowSolver> solver = createDataFlowSolver(); 801 - + SharedMemoryAliasAnalysis *aliasAnalysis = 802 - + solver->load<SharedMemoryAliasAnalysis>(); 803 - + if (failed(solver->initializeAndRun(operation))) { 804 - + // TODO: return error instead of bailing out.. 805 - + llvm_unreachable("failed to run SharedMemoryAliasAnalysis"); 806 - + } 807 - operation->walk<WalkOrder::PreOrder>([&](Operation *op) { 808 - for (auto operand : op->getOperands()) { 809 - - getValueAlias(operand, aliasAnalysis); 810 - + getValueAlias(operand, *aliasAnalysis); 811 - } 812 - for (auto value : op->getResults()) { 813 - - getValueAlias(value, aliasAnalysis); 814 - + getValueAlias(value, *aliasAnalysis); 815 - } 816 - }); 817 - } 818 - diff --git a/lib/Analysis/AxisInfo.cpp b/lib/Analysis/AxisInfo.cpp 819 - index 0b7142b04d..4af46c3fbb 100644 820 - --- a/lib/Analysis/AxisInfo.cpp 821 - +++ b/lib/Analysis/AxisInfo.cpp 822 - @@ -1,4 +1,4 @@ 823 - -#include "mlir/Analysis/DataFlowAnalysis.h" 824 - +#include "mlir/Analysis/DataFlowFramework.h" 825 - #include "mlir/Dialect/LLVMIR/LLVMDialect.h" 826 - #include "llvm/Support/raw_ostream.h" 827 - 828 - @@ -52,7 +52,7 @@ AxisInfo AxisInfo::getPessimisticValueState(Value value) { 829 - BlockArgument blockArg = value.dyn_cast<BlockArgument>(); 830 - if (blockArg && blockArg.getOwner()->isEntryBlock()) { 831 - Operation *op = blockArg.getOwner()->getParentOp(); 832 - - if (FuncOp fun = dyn_cast<FuncOp>(op)) { 833 - + if (func::FuncOp fun = dyn_cast<func::FuncOp>(op)) { 834 - Attribute attr = 835 - fun.getArgAttr(blockArg.getArgNumber(), "tt.divisibility"); 836 - if (attr) 837 - @@ -136,8 +136,9 @@ class CastOpAxisInfoVisitor final : public AxisInfoVisitorImpl<OpTy> { 838 - public: 839 - using AxisInfoVisitorImpl<OpTy>::AxisInfoVisitorImpl; 840 - 841 - - AxisInfo getAxisInfo(OpTy op, 842 - - ArrayRef<LatticeElement<AxisInfo> *> operands) override { 843 - + AxisInfo 844 - + getAxisInfo(OpTy op, 845 - + ArrayRef<const dataflow::Lattice<AxisInfo> *> operands) override { 846 - return operands[0]->getValue(); 847 - } 848 - }; 849 - @@ -147,8 +148,9 @@ class MakeRangeOpAxisInfoVisitor final 850 - public: 851 - using AxisInfoVisitorImpl<triton::MakeRangeOp>::AxisInfoVisitorImpl; 852 - 853 - - AxisInfo getAxisInfo(triton::MakeRangeOp op, 854 - - ArrayRef<LatticeElement<AxisInfo> *> operands) override { 855 - + AxisInfo 856 - + getAxisInfo(triton::MakeRangeOp op, 857 - + ArrayRef<const dataflow::Lattice<AxisInfo> *> operands) override { 858 - auto start = op.start(); 859 - auto end = op.end(); 860 - return AxisInfo(/*contiguity=*/{end - start}, 861 - @@ -162,8 +164,9 @@ class ConstantOpAxisInfoVisitor final 862 - public: 863 - using AxisInfoVisitorImpl<arith::ConstantOp>::AxisInfoVisitorImpl; 864 - 865 - - AxisInfo getAxisInfo(arith::ConstantOp op, 866 - - ArrayRef<LatticeElement<AxisInfo> *> operands) override { 867 - + AxisInfo 868 - + getAxisInfo(arith::ConstantOp op, 869 - + ArrayRef<const dataflow::Lattice<AxisInfo> *> operands) override { 870 - auto intAttr = op.getValue().dyn_cast<IntegerAttr>(); 871 - auto boolAttr = op.getValue().dyn_cast<BoolAttr>(); 872 - if (intAttr || boolAttr) { 873 - @@ -416,8 +419,9 @@ class SplatOpAxisInfoVisitor final 874 - public: 875 - using AxisInfoVisitorImpl<triton::SplatOp>::AxisInfoVisitorImpl; 876 - 877 - - AxisInfo getAxisInfo(triton::SplatOp op, 878 - - ArrayRef<LatticeElement<AxisInfo> *> operands) override { 879 - + AxisInfo 880 - + getAxisInfo(triton::SplatOp op, 881 - + ArrayRef<const dataflow::Lattice<AxisInfo> *> operands) override { 882 - Type _retTy = *op->result_type_begin(); 883 - TensorType retTy = _retTy.cast<TensorType>(); 884 - AxisInfo opInfo = operands[0]->getValue(); 885 - @@ -439,8 +443,9 @@ class ExpandDimsOpAxisInfoVisitor final 886 - public: 887 - using AxisInfoVisitorImpl<triton::ExpandDimsOp>::AxisInfoVisitorImpl; 888 - 889 - - AxisInfo getAxisInfo(triton::ExpandDimsOp op, 890 - - ArrayRef<LatticeElement<AxisInfo> *> operands) override { 891 - + AxisInfo 892 - + getAxisInfo(triton::ExpandDimsOp op, 893 - + ArrayRef<const dataflow::Lattice<AxisInfo> *> operands) override { 894 - AxisInfo opInfo = operands[0]->getValue(); 895 - AxisInfo::DimVectorT contiguity = opInfo.getContiguity(); 896 - AxisInfo::DimVectorT divisibility = opInfo.getDivisibility(); 897 - @@ -458,8 +463,9 @@ class BroadcastOpAxisInfoVisitor final 898 - public: 899 - using AxisInfoVisitorImpl<triton::BroadcastOp>::AxisInfoVisitorImpl; 900 - 901 - - AxisInfo getAxisInfo(triton::BroadcastOp op, 902 - - ArrayRef<LatticeElement<AxisInfo> *> operands) override { 903 - + AxisInfo 904 - + getAxisInfo(triton::BroadcastOp op, 905 - + ArrayRef<const dataflow::Lattice<AxisInfo> *> operands) override { 906 - Type _retTy = *op->result_type_begin(); 907 - Type _opTy = *op->operand_type_begin(); 908 - TensorType retTy = _retTy.cast<TensorType>(); 909 - @@ -486,8 +492,9 @@ class CmpOpAxisInfoVisitor final : public AxisInfoVisitorImpl<OpTy> { 910 - public: 911 - using AxisInfoVisitorImpl<OpTy>::AxisInfoVisitorImpl; 912 - 913 - - AxisInfo getAxisInfo(OpTy op, 914 - - ArrayRef<LatticeElement<AxisInfo> *> operands) override { 915 - + AxisInfo 916 - + getAxisInfo(OpTy op, 917 - + ArrayRef<const dataflow::Lattice<AxisInfo> *> operands) override { 918 - auto resTy = op.getResult().getType().template dyn_cast<RankedTensorType>(); 919 - if (!resTy) 920 - return AxisInfo(); 921 - @@ -596,8 +603,9 @@ class SelectOpAxisInfoVisitor final : public AxisInfoVisitorImpl<OpTy> { 922 - public: 923 - using AxisInfoVisitorImpl<OpTy>::AxisInfoVisitorImpl; 924 - 925 - - AxisInfo getAxisInfo(OpTy op, 926 - - ArrayRef<LatticeElement<AxisInfo> *> operands) override { 927 - + AxisInfo 928 - + getAxisInfo(OpTy op, 929 - + ArrayRef<const dataflow::Lattice<AxisInfo> *> operands) override { 930 - auto resTy = op.getResult().getType().template dyn_cast<RankedTensorType>(); 931 - if (!resTy) 932 - return AxisInfo(); 933 - @@ -757,8 +765,9 @@ class MaxMinOpAxisInfoVisitor final : public AxisInfoVisitorImpl<OpTy> { 934 - public: 935 - using AxisInfoVisitorImpl<OpTy>::AxisInfoVisitorImpl; 936 - 937 - - AxisInfo getAxisInfo(OpTy op, 938 - - ArrayRef<LatticeElement<AxisInfo> *> operands) override { 939 - + AxisInfo 940 - + getAxisInfo(OpTy op, 941 - + ArrayRef<const dataflow::Lattice<AxisInfo> *> operands) override { 942 - auto lhsInfo = operands[0]->getValue(); 943 - auto rhsInfo = operands[1]->getValue(); 944 - std::optional<int64_t> constantValue; 945 - @@ -786,8 +795,8 @@ class MaxMinOpAxisInfoVisitor final : public AxisInfoVisitorImpl<OpTy> { 946 - // AxisInfoAnalysis 947 - //===----------------------------------------------------------------------===// 948 - 949 - -AxisInfoAnalysis::AxisInfoAnalysis(MLIRContext *context) 950 - - : ForwardDataFlowAnalysis<AxisInfo>(context) { 951 - +AxisInfoAnalysis::AxisInfoAnalysis(DataFlowSolver &solver) 952 - + : dataflow::SparseDataFlowAnalysis<dataflow::Lattice<AxisInfo>>(solver) { 953 - // UnrealizedConversionCast: 954 - // This is needed by TritonGPUToLLVM, to get AxisInfo when the graph is 955 - // in the process of a PartialConversion, where UnrealizedConversionCast 956 - @@ -819,7 +828,7 @@ AxisInfoAnalysis::AxisInfoAnalysis(MLIRContext *context) 957 - visitors.append<LogicalOpAxisInfoVisitor<arith::AndIOp>, 958 - LogicalOpAxisInfoVisitor<arith::OrIOp>, 959 - LogicalOpAxisInfoVisitor<arith::XOrIOp>>(); 960 - - visitors.append<SelectOpAxisInfoVisitor<mlir::SelectOp>, 961 - + visitors.append<SelectOpAxisInfoVisitor<mlir::arith::SelectOp>, 962 - SelectOpAxisInfoVisitor<triton::gpu::SelectOp>>(); 963 - visitors.append<ShLIOpAxisInfoVisitor, ShROpAxisInfoVisitor<arith::ShRUIOp>, 964 - ShROpAxisInfoVisitor<arith::ShRSIOp>>(); 965 - @@ -829,11 +838,12 @@ AxisInfoAnalysis::AxisInfoAnalysis(MLIRContext *context) 966 - MaxMinOpAxisInfoVisitor<arith::MinUIOp>>(); 967 - } 968 - 969 - -ChangeResult AxisInfoAnalysis::visitOperation( 970 - - Operation *op, ArrayRef<LatticeElement<AxisInfo> *> operands) { 971 - +void AxisInfoAnalysis::visitOperation( 972 - + Operation *op, ArrayRef<const dataflow::Lattice<AxisInfo> *> operands, 973 - + ArrayRef<dataflow::Lattice<AxisInfo> *> results) { 974 - AxisInfo curr = visitors.apply(op, operands); 975 - if (curr.getRank() == 0) { 976 - - return markAllPessimisticFixpoint(op->getResults()); 977 - + return markAllPessimisticFixpoint(results); 978 - } 979 - // override with hint 980 - auto newContiguity = curr.getContiguity(); 981 - @@ -854,11 +864,8 @@ ChangeResult AxisInfoAnalysis::visitOperation( 982 - curr = mlir::AxisInfo(newContiguity, newDivisibility, newConstancy, 983 - curr.getConstantValue()); 984 - // join all lattice elements 985 - - ChangeResult result = ChangeResult::NoChange; 986 - - for (Value value : op->getResults()) { 987 - - result |= getLatticeElement(value).join(curr); 988 - - } 989 - - return result; 990 - + for (auto *result : results) 991 - + propagateIfChanged(result, result->join(curr)); 992 - } 993 - 994 - unsigned AxisInfoAnalysis::getPtrContiguity(Value ptr) { 995 - @@ -884,7 +891,10 @@ unsigned AxisInfoAnalysis::getPtrAlignment(Value ptr) { 996 - auto tensorTy = ptr.getType().dyn_cast<RankedTensorType>(); 997 - if (!tensorTy) 998 - return 1; 999 - - auto axisInfo = lookupLatticeElement(ptr)->getValue(); 1000 - + dataflow::Lattice<AxisInfo> *latticeElement = getLatticeElement(ptr); 1001 - + if (!latticeElement || latticeElement->isUninitialized()) 1002 - + return 1; 1003 - + auto axisInfo = latticeElement->getValue(); 1004 - auto layout = tensorTy.getEncoding(); 1005 - auto order = triton::gpu::getOrder(layout); 1006 - auto maxMultipleBytes = axisInfo.getDivisibility(order[0]); 1007 - @@ -900,8 +910,11 @@ unsigned AxisInfoAnalysis::getMaskAlignment(Value mask) { 1008 - auto tensorTy = mask.getType().dyn_cast<RankedTensorType>(); 1009 - if (!tensorTy) 1010 - return 1; 1011 - + dataflow::Lattice<AxisInfo> *latticeElement = getLatticeElement(mask); 1012 - + if (!latticeElement || latticeElement->isUninitialized()) 1013 - + return 1; 1014 - + auto maskAxis = latticeElement->getValue(); 1015 - auto maskOrder = triton::gpu::getOrder(tensorTy.getEncoding()); 1016 - - auto maskAxis = lookupLatticeElement(mask)->getValue(); 1017 - auto alignment = std::max<unsigned>(maskAxis.getConstancy(maskOrder[0]), 1); 1018 - return alignment; 1019 - } 1020 - diff --git a/lib/Analysis/CMakeLists.txt b/lib/Analysis/CMakeLists.txt 1021 - index afbc692510..1f761f845c 100644 1022 - --- a/lib/Analysis/CMakeLists.txt 1023 - +++ b/lib/Analysis/CMakeLists.txt 1024 - @@ -8,7 +8,7 @@ add_mlir_library(TritonAnalysis 1025 - DEPENDS 1026 - TritonTableGen 1027 - TritonGPUAttrDefsIncGen 1028 - - 1029 - + 1030 - LINK_LIBS PUBLIC 1031 - MLIRAnalysis 1032 - ) 1033 - diff --git a/lib/Analysis/Membar.cpp b/lib/Analysis/Membar.cpp 1034 - index acc885e827..910274b2ac 100644 1035 - --- a/lib/Analysis/Membar.cpp 1036 - +++ b/lib/Analysis/Membar.cpp 1037 - @@ -2,7 +2,7 @@ 1038 - #include "triton/Analysis/Alias.h" 1039 - #include "triton/Dialect/TritonGPU/IR/Dialect.h" 1040 - 1041 - -#include "mlir/Dialect/GPU/GPUDialect.h" 1042 - +#include "mlir/Dialect/GPU/IR/GPUDialect.h" 1043 - #include "mlir/Dialect/Tensor/IR/Tensor.h" 1044 - 1045 - namespace mlir { 1046 - diff --git a/lib/Analysis/Utility.cpp b/lib/Analysis/Utility.cpp 1047 - index d9e917e731..6ea52df272 100644 1048 - --- a/lib/Analysis/Utility.cpp 1049 - +++ b/lib/Analysis/Utility.cpp 1050 - @@ -1,5 +1,8 @@ 1051 - #include "triton/Analysis/Utility.h" 1052 - +#include "mlir/Analysis/DataFlow/ConstantPropagationAnalysis.h" 1053 - +#include "mlir/Analysis/DataFlow/DeadCodeAnalysis.h" 1054 - #include "mlir/IR/Dialect.h" 1055 - +#include "mlir/IR/Matchers.h" 1056 - #include "triton/Dialect/Triton/IR/Dialect.h" 1057 - #include "triton/Dialect/TritonGPU/IR/Dialect.h" 1058 - #include <deque> 1059 - @@ -325,4 +328,55 @@ SetVector<Operation *> multiRootGetSlice(Operation *op, 1060 - return multiRootTopologicalSort(slice); 1061 - } 1062 - 1063 - +namespace { 1064 - +// Copied from TestDeadCodeAnalysis.cpp, because some dead code analysis 1065 - +// interacts with constant propagation, but SparseConstantPropagation 1066 - +// doesn't seem to be sufficient. 1067 - +struct ConstantAnalysis : public DataFlowAnalysis { 1068 - + using DataFlowAnalysis::DataFlowAnalysis; 1069 - + 1070 - + LogicalResult initialize(Operation *top) override { 1071 - + WalkResult result = top->walk([&](Operation *op) { 1072 - + if (failed(visit(op))) 1073 - + return WalkResult::interrupt(); 1074 - + return WalkResult::advance(); 1075 - + }); 1076 - + return success(!result.wasInterrupted()); 1077 - + } 1078 - + 1079 - + LogicalResult visit(ProgramPoint point) override { 1080 - + Operation *op = point.get<Operation *>(); 1081 - + Attribute value; 1082 - + if (matchPattern(op, m_Constant(&value))) { 1083 - + auto *constant = getOrCreate<dataflow::Lattice<dataflow::ConstantValue>>( 1084 - + op->getResult(0)); 1085 - + propagateIfChanged(constant, constant->join(dataflow::ConstantValue( 1086 - + value, op->getDialect()))); 1087 - + return success(); 1088 - + } 1089 - + setAllToUnknownConstants(op->getResults()); 1090 - + for (Region &region : op->getRegions()) 1091 - + setAllToUnknownConstants(region.getArguments()); 1092 - + return success(); 1093 - + } 1094 - + 1095 - + /// Set all given values as not constants. 1096 - + void setAllToUnknownConstants(ValueRange values) { 1097 - + dataflow::ConstantValue unknownConstant(nullptr, nullptr); 1098 - + for (Value value : values) { 1099 - + auto *constant = 1100 - + getOrCreate<dataflow::Lattice<dataflow::ConstantValue>>(value); 1101 - + propagateIfChanged(constant, constant->join(unknownConstant)); 1102 - + } 1103 - + } 1104 - +}; 1105 - +} // namespace 1106 - + 1107 - +std::unique_ptr<DataFlowSolver> createDataFlowSolver() { 1108 - + auto solver = std::make_unique<DataFlowSolver>(); 1109 - + solver->load<dataflow::DeadCodeAnalysis>(); 1110 - + solver->load<ConstantAnalysis>(); 1111 - + return solver; 1112 - +} 1113 - + 1114 - } // namespace mlir 1115 - diff --git a/lib/Conversion/TritonGPUToLLVM/ConvertLayoutOpToLLVM.cpp b/lib/Conversion/TritonGPUToLLVM/ConvertLayoutOpToLLVM.cpp 1116 - index 6a46265bd7..e352eb3698 100644 1117 - --- a/lib/Conversion/TritonGPUToLLVM/ConvertLayoutOpToLLVM.cpp 1118 - +++ b/lib/Conversion/TritonGPUToLLVM/ConvertLayoutOpToLLVM.cpp 1119 - @@ -159,9 +159,6 @@ struct ConvertLayoutOpConversion 1120 - Value smemBase) const { 1121 - auto accumNumCTAsEachRep = product<unsigned>(numCTAsEachRep); 1122 - auto layout = type.getEncoding(); 1123 - - auto blockedLayout = layout.dyn_cast<BlockedEncodingAttr>(); 1124 - - auto sliceLayout = layout.dyn_cast<SliceEncodingAttr>(); 1125 - - auto mmaLayout = layout.dyn_cast<MmaEncodingAttr>(); 1126 - auto rank = type.getRank(); 1127 - auto sizePerThread = getSizePerThread(layout); 1128 - auto accumSizePerThread = product<unsigned>(sizePerThread); 1129 - diff --git a/lib/Conversion/TritonGPUToLLVM/DotOpHelpers.h b/lib/Conversion/TritonGPUToLLVM/DotOpHelpers.h 1130 - index 4b89965aa9..1d9e00519b 100644 1131 - --- a/lib/Conversion/TritonGPUToLLVM/DotOpHelpers.h 1132 - +++ b/lib/Conversion/TritonGPUToLLVM/DotOpHelpers.h 1133 - @@ -7,10 +7,8 @@ 1134 - #include "mlir/Conversion/LLVMCommon/LoweringOptions.h" 1135 - #include "mlir/Conversion/LLVMCommon/Pattern.h" 1136 - #include "mlir/Conversion/MathToLLVM/MathToLLVM.h" 1137 - -#include "mlir/Conversion/SCFToStandard/SCFToStandard.h" 1138 - -#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h" 1139 - #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h" 1140 - -#include "mlir/Dialect/GPU/GPUDialect.h" 1141 - +#include "mlir/Dialect/GPU/IR/GPUDialect.h" 1142 - #include "mlir/Dialect/LLVMIR/LLVMDialect.h" 1143 - #include "mlir/Dialect/Tensor/IR/Tensor.h" 1144 - #include "mlir/IR/Matchers.h" 1145 - @@ -422,9 +420,9 @@ struct MMA16816ConversionHelper { 1146 - MMA16816ConversionHelper(Type dotOperand, MmaEncodingAttr mmaLayout, 1147 - Value thread, ConversionPatternRewriter &rewriter, 1148 - TypeConverter *typeConverter, Location loc) 1149 - - : mmaLayout(mmaLayout), thread(thread), helper(mmaLayout), 1150 - - rewriter(rewriter), typeConverter(typeConverter), loc(loc), 1151 - - ctx(mmaLayout.getContext()), wpt(mmaLayout.getWarpsPerCTA()) { 1152 - + : mmaLayout(mmaLayout), wpt(mmaLayout.getWarpsPerCTA()), thread(thread), 1153 - + helper(mmaLayout), rewriter(rewriter), typeConverter(typeConverter), 1154 - + loc(loc), ctx(mmaLayout.getContext()) { 1155 - helper.deduceMmaType(dotOperand); 1156 - 1157 - Value _32 = i32_val(32); 1158 - diff --git a/lib/Conversion/TritonGPUToLLVM/DotOpToLLVM.cpp b/lib/Conversion/TritonGPUToLLVM/DotOpToLLVM.cpp 1159 - index 0f8070ca9f..e4bd47c411 100644 1160 - --- a/lib/Conversion/TritonGPUToLLVM/DotOpToLLVM.cpp 1161 - +++ b/lib/Conversion/TritonGPUToLLVM/DotOpToLLVM.cpp 1162 - @@ -115,8 +115,6 @@ struct DotOpConversion : public ConvertTritonGPUOpToLLVMPattern<triton::DotOp> { 1163 - auto DTensorTy = D.getType().cast<RankedTensorType>(); 1164 - auto AShape = ATensorTy.getShape(); 1165 - auto BShape = BTensorTy.getShape(); 1166 - - auto DShape = DTensorTy.getShape(); 1167 - - auto wpt = mmaLayout.getWarpsPerCTA(); 1168 - 1169 - bool isARow = ALayout.getIsMMAv1Row().cast<BoolAttr>().getValue(); 1170 - bool isBRow = BLayout.getIsMMAv1Row().cast<BoolAttr>().getValue(); 1171 - @@ -221,7 +219,6 @@ struct DotOpConversion : public ConvertTritonGPUOpToLLVMPattern<triton::DotOp> { 1172 - ConversionPatternRewriter &rewriter) const { 1173 - auto *ctx = rewriter.getContext(); 1174 - auto loc = op.getLoc(); 1175 - - auto threadId = getThreadId(rewriter, loc); 1176 - 1177 - auto A = op.a(); 1178 - auto B = op.b(); 1179 - @@ -230,12 +227,10 @@ struct DotOpConversion : public ConvertTritonGPUOpToLLVMPattern<triton::DotOp> { 1180 - 1181 - auto aTensorTy = A.getType().cast<RankedTensorType>(); 1182 - auto bTensorTy = B.getType().cast<RankedTensorType>(); 1183 - - auto cTensorTy = C.getType().cast<RankedTensorType>(); 1184 - auto dTensorTy = D.getType().cast<RankedTensorType>(); 1185 - 1186 - auto aShape = aTensorTy.getShape(); 1187 - auto bShape = bTensorTy.getShape(); 1188 - - auto cShape = cTensorTy.getShape(); 1189 - 1190 - BlockedEncodingAttr dLayout = 1191 - dTensorTy.getEncoding().cast<BlockedEncodingAttr>(); 1192 - diff --git a/lib/Conversion/TritonGPUToLLVM/ElementwiseOpToLLVM.cpp b/lib/Conversion/TritonGPUToLLVM/ElementwiseOpToLLVM.cpp 1193 - index deb71b9597..0b9e67674b 100644 1194 - --- a/lib/Conversion/TritonGPUToLLVM/ElementwiseOpToLLVM.cpp 1195 - +++ b/lib/Conversion/TritonGPUToLLVM/ElementwiseOpToLLVM.cpp 1196 - @@ -61,7 +61,6 @@ struct FpToFpOpConversion 1197 - convertFp16x4ToFp8x4(Location loc, ConversionPatternRewriter &rewriter, 1198 - const Value &v0, const Value &v1, const Value &v2, 1199 - const Value &v3) { 1200 - - auto ctx = rewriter.getContext(); 1201 - auto fp16x2VecTy = vec_ty(f16_ty, 2); 1202 - Value fp16x2Vec0 = undef(fp16x2VecTy); 1203 - Value fp16x2Vec1 = undef(fp16x2VecTy); 1204 - @@ -153,7 +152,6 @@ struct FpToFpOpConversion 1205 - convertBf16x4ToFp8x4(Location loc, ConversionPatternRewriter &rewriter, 1206 - const Value &v0, const Value &v1, const Value &v2, 1207 - const Value &v3) { 1208 - - auto ctx = rewriter.getContext(); 1209 - auto bf16x2VecTy = vec_ty(i16_ty, 2); 1210 - Value bf16x2Vec0 = undef(bf16x2VecTy); 1211 - Value bf16x2Vec1 = undef(bf16x2VecTy); 1212 - diff --git a/lib/Conversion/TritonGPUToLLVM/LoadStoreOpToLLVM.cpp b/lib/Conversion/TritonGPUToLLVM/LoadStoreOpToLLVM.cpp 1213 - index 9a8b4702bc..bae675f0cb 100644 1214 - --- a/lib/Conversion/TritonGPUToLLVM/LoadStoreOpToLLVM.cpp 1215 - +++ b/lib/Conversion/TritonGPUToLLVM/LoadStoreOpToLLVM.cpp 1216 - @@ -109,7 +109,8 @@ struct LoadOpConversion 1217 - DenseElementsAttr constAttr; 1218 - int64_t splatVal = 0; 1219 - if (other && valueElemTy.isa<IntegerType>() && 1220 - - matchPattern(other, m_Constant(&constAttr)) && constAttr.isSplat()) { 1221 - + matchPattern(other, m_Constant(&constAttr)) && constAttr.isSplat() && 1222 - + constAttr.getElementType().isa<IntegerType>()) { 1223 - otherIsSplatConstInt = true; 1224 - splatVal = constAttr.getSplatValue<APInt>().getSExtValue(); 1225 - } 1226 - @@ -333,7 +334,6 @@ struct StoreOpConversion 1227 - elem = rewriter.create<LLVM::SExtOp>(loc, type::i8Ty(ctx), elem); 1228 - elem = bitcast(elem, valueElemTy); 1229 - 1230 - - Type u32Ty = typeConverter->convertType(type::u32Ty(ctx)); 1231 - llWord = insert_element(wordTy, llWord, elem, i32_val(elemIdx)); 1232 - } 1233 - llWord = bitcast(llWord, valArgTy); 1234 - @@ -387,7 +387,6 @@ struct AtomicCASOpConversion 1235 - ConversionPatternRewriter &rewriter) const override { 1236 - auto loc = op.getLoc(); 1237 - MLIRContext *ctx = rewriter.getContext(); 1238 - - Value ptr = op.ptr(); 1239 - 1240 - Value llPtr = adaptor.ptr(); 1241 - Value llCmp = adaptor.cmp(); 1242 - diff --git a/lib/Conversion/TritonGPUToLLVM/ReduceOpToLLVM.cpp b/lib/Conversion/TritonGPUToLLVM/ReduceOpToLLVM.cpp 1243 - index 69abd889be..1c973dc196 100644 1244 - --- a/lib/Conversion/TritonGPUToLLVM/ReduceOpToLLVM.cpp 1245 - +++ b/lib/Conversion/TritonGPUToLLVM/ReduceOpToLLVM.cpp 1246 - @@ -286,7 +286,6 @@ struct ReduceOpConversion 1247 - auto srcTy = op.operand().getType().cast<RankedTensorType>(); 1248 - auto srcLayout = srcTy.getEncoding(); 1249 - auto srcShape = srcTy.getShape(); 1250 - - auto srcRank = srcTy.getRank(); 1251 - auto order = getOrder(srcLayout); 1252 - 1253 - auto threadsPerWarp = triton::gpu::getThreadsPerWarp(srcLayout); 1254 - @@ -351,7 +350,6 @@ struct ReduceOpConversion 1255 - 1256 - Value zero = i32_val(0); 1257 - Value laneZero = icmp_eq(laneIdAxis, zero); 1258 - - Value warpZero = icmp_eq(warpIdAxis, zero); 1259 - 1260 - for (auto it : accs) { 1261 - const SmallVector<unsigned> &key = it.first; 1262 - diff --git a/lib/Conversion/TritonGPUToLLVM/TritonGPUToLLVM.cpp b/lib/Conversion/TritonGPUToLLVM/TritonGPUToLLVM.cpp 1263 - index 5b77150b1a..78cfa076bd 100644 1264 - --- a/lib/Conversion/TritonGPUToLLVM/TritonGPUToLLVM.cpp 1265 - +++ b/lib/Conversion/TritonGPUToLLVM/TritonGPUToLLVM.cpp 1266 - @@ -11,11 +11,11 @@ using ::mlir::LLVM::getStructFromElements; 1267 - using ::mlir::triton::gpu::getElemsPerThread; 1268 - using ::mlir::triton::gpu::SharedEncodingAttr; 1269 - 1270 - -struct ReturnOpConversion : public ConvertOpToLLVMPattern<::mlir::ReturnOp> { 1271 - - using ConvertOpToLLVMPattern<ReturnOp>::ConvertOpToLLVMPattern; 1272 - +struct ReturnOpConversion : public ConvertOpToLLVMPattern<func::ReturnOp> { 1273 - + using ConvertOpToLLVMPattern<func::ReturnOp>::ConvertOpToLLVMPattern; 1274 - 1275 - LogicalResult 1276 - - matchAndRewrite(ReturnOp op, OpAdaptor adaptor, 1277 - + matchAndRewrite(func::ReturnOp op, OpAdaptor adaptor, 1278 - ConversionPatternRewriter &rewriter) const override { 1279 - unsigned numArguments = op.getNumOperands(); 1280 - 1281 - @@ -476,7 +476,6 @@ struct ExtractSliceOpConversion 1282 - 1283 - auto llvmElemTy = getTypeConverter()->convertType(srcTy.getElementType()); 1284 - auto elemPtrTy = ptr_ty(llvmElemTy, 3); 1285 - - auto resTy = op.getType().dyn_cast<RankedTensorType>(); 1286 - smemObj = SharedMemoryObject(gep(elemPtrTy, smemObj.base, offset), 1287 - strideVals, offsetVals); 1288 - auto retVal = getStructFromSharedMemoryObject(loc, smemObj, rewriter); 1289 - diff --git a/lib/Conversion/TritonGPUToLLVM/TritonGPUToLLVMBase.h b/lib/Conversion/TritonGPUToLLVM/TritonGPUToLLVMBase.h 1290 - index bb10d5b24a..00e399f848 100644 1291 - --- a/lib/Conversion/TritonGPUToLLVM/TritonGPUToLLVMBase.h 1292 - +++ b/lib/Conversion/TritonGPUToLLVM/TritonGPUToLLVMBase.h 1293 - @@ -4,6 +4,7 @@ 1294 - // TODO: refactor so that it doesn't fail if Allocation.h 1295 - // is included after utility.h (due to conflict in `store` macro 1296 - // and <atomic> 1297 - +#include "mlir/Dialect/Func/IR/FuncOps.h" 1298 - #include "triton/Analysis/Allocation.h" 1299 - 1300 - // 1301 - @@ -39,15 +40,15 @@ void vprintf_array(Value thread, ArrayRef<Value> arr, std::string info, 1302 - // TODO(Superjomn): remove the code when MLIR v15.0 is included. 1303 - // All the rights are reserved by the LLVM community. 1304 - 1305 - -struct FuncOpConversionBase : public ConvertOpToLLVMPattern<FuncOp> { 1306 - +struct FuncOpConversionBase : public ConvertOpToLLVMPattern<func::FuncOp> { 1307 - private: 1308 - /// Only retain those attributes that are not constructed by 1309 - /// `LLVMFuncOp::build`. If `filterArgAttrs` is set, also filter out argument 1310 - /// attributes. 1311 - - static void filterFuncAttributes(ArrayRef<NamedAttribute> attrs, 1312 - - bool filterArgAttrs, 1313 - + static void filterFuncAttributes(func::FuncOp op, bool filterArgAttrs, 1314 - SmallVectorImpl<NamedAttribute> &result) { 1315 - - for (const auto &attr : attrs) { 1316 - + 1317 - + for (const auto &attr : op->getAttrs()) { 1318 - if (attr.getName() == SymbolTable::getSymbolAttrName() || 1319 - attr.getName() == FunctionOpInterface::getTypeAttrName() || 1320 - attr.getName() == "std.varargs" || 1321 - @@ -65,27 +66,27 @@ struct FuncOpConversionBase : public ConvertOpToLLVMPattern<FuncOp> { 1322 - } 1323 - 1324 - protected: 1325 - - using ConvertOpToLLVMPattern<FuncOp>::ConvertOpToLLVMPattern; 1326 - + using ConvertOpToLLVMPattern<func::FuncOp>::ConvertOpToLLVMPattern; 1327 - 1328 - // Convert input FuncOp to LLVMFuncOp by using the LLVMTypeConverter provided 1329 - // to this legalization pattern. 1330 - LLVM::LLVMFuncOp 1331 - - convertFuncOpToLLVMFuncOp(FuncOp funcOp, 1332 - + convertFuncOpToLLVMFuncOp(func::FuncOp funcOp, 1333 - ConversionPatternRewriter &rewriter) const { 1334 - // Convert the original function arguments. They are converted using the 1335 - // LLVMTypeConverter provided to this legalization pattern. 1336 - auto varargsAttr = funcOp->getAttrOfType<BoolAttr>("func.varargs"); 1337 - TypeConverter::SignatureConversion result(funcOp.getNumArguments()); 1338 - auto llvmType = getTypeConverter()->convertFunctionSignature( 1339 - - funcOp.getType(), varargsAttr && varargsAttr.getValue(), result); 1340 - + funcOp.getFunctionType(), varargsAttr && varargsAttr.getValue(), 1341 - + result); 1342 - if (!llvmType) 1343 - return nullptr; 1344 - 1345 - // Propagate argument/result attributes to all converted arguments/result 1346 - // obtained after converting a given original argument/result. 1347 - SmallVector<NamedAttribute, 4> attributes; 1348 - - filterFuncAttributes(funcOp->getAttrs(), /*filterArgAttrs=*/true, 1349 - - attributes); 1350 - + filterFuncAttributes(funcOp, /*filterArgAttrs=*/true, attributes); 1351 - if (ArrayAttr resAttrDicts = funcOp.getAllResultAttrs()) { 1352 - assert(!resAttrDicts.empty() && "expected array to be non-empty"); 1353 - auto newResAttrDicts = 1354 - @@ -131,7 +132,7 @@ struct FuncOpConversionBase : public ConvertOpToLLVMPattern<FuncOp> { 1355 - } 1356 - auto newFuncOp = rewriter.create<LLVM::LLVMFuncOp>( 1357 - funcOp.getLoc(), funcOp.getName(), llvmType, linkage, 1358 - - /*dsoLocal*/ false, attributes); 1359 - + /*dsoLocal*/ false, LLVM::CConv::C, attributes); 1360 - rewriter.inlineRegionBefore(funcOp.getBody(), newFuncOp.getBody(), 1361 - newFuncOp.end()); 1362 - if (failed(rewriter.convertRegionTypes(&newFuncOp.getBody(), *typeConverter, 1363 - @@ -191,8 +192,8 @@ class ConvertTritonGPUOpToLLVMPatternBase { 1364 - const Allocation *allocation, 1365 - Value smem, 1366 - IndexCacheInfo indexCacheInfo) 1367 - - : converter(&typeConverter), indexCacheInfo(indexCacheInfo), 1368 - - allocation(allocation), smem(smem) {} 1369 - + : converter(&typeConverter), allocation(allocation), smem(smem), 1370 - + indexCacheInfo(indexCacheInfo) {} 1371 - 1372 - LLVMTypeConverter *getTypeConverter() const { return converter; } 1373 - 1374 - @@ -861,7 +862,6 @@ class ConvertTritonGPUOpToLLVMPatternBase { 1375 - ArrayRef<int64_t> shape) const { 1376 - auto parent = sliceLayout.getParent(); 1377 - unsigned dim = sliceLayout.getDim(); 1378 - - size_t rank = shape.size(); 1379 - auto parentIndices = 1380 - emitIndices(loc, rewriter, parent, sliceLayout.paddedShape(shape)); 1381 - unsigned numIndices = parentIndices.size(); 1382 - diff --git a/lib/Conversion/TritonGPUToLLVM/TritonGPUToLLVMPass.cpp b/lib/Conversion/TritonGPUToLLVM/TritonGPUToLLVMPass.cpp 1383 - index ff1af09835..6f66af4e34 100644 1384 - --- a/lib/Conversion/TritonGPUToLLVM/TritonGPUToLLVMPass.cpp 1385 - +++ b/lib/Conversion/TritonGPUToLLVM/TritonGPUToLLVMPass.cpp 1386 - @@ -1,10 +1,11 @@ 1387 - #include "triton/Conversion/TritonGPUToLLVM/TritonGPUToLLVMPass.h" 1388 - 1389 - +#include "mlir/Analysis/DataFlowFramework.h" 1390 - #include "mlir/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.h" 1391 - +#include "mlir/Conversion/ControlFlowToLLVM//ControlFlowToLLVM.h" 1392 - #include "mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h" 1393 - #include "mlir/Conversion/MathToLLVM/MathToLLVM.h" 1394 - -#include "mlir/Conversion/SCFToStandard/SCFToStandard.h" 1395 - -#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h" 1396 - +#include "mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h" 1397 - #include "mlir/Dialect/LLVMIR/LLVMDialect.h" 1398 - #include "mlir/Dialect/LLVMIR/NVVMDialect.h" 1399 - #include "mlir/Pass/Pass.h" 1400 - @@ -40,7 +41,6 @@ class TritonLLVMConversionTarget : public ConversionTarget { 1401 - addIllegalDialect<triton::TritonDialect>(); 1402 - addIllegalDialect<triton::gpu::TritonGPUDialect>(); 1403 - addIllegalDialect<mlir::gpu::GPUDialect>(); 1404 - - addIllegalDialect<mlir::StandardOpsDialect>(); 1405 - addLegalOp<mlir::UnrealizedConversionCastOp>(); 1406 - } 1407 - }; 1408 - @@ -51,7 +51,7 @@ class TritonLLVMFunctionConversionTarget : public ConversionTarget { 1409 - : ConversionTarget(ctx) { 1410 - addLegalDialect<LLVM::LLVMDialect>(); 1411 - addLegalDialect<NVVM::NVVMDialect>(); 1412 - - addIllegalOp<mlir::FuncOp>(); 1413 - + addIllegalOp<mlir::func::FuncOp>(); 1414 - addLegalOp<mlir::UnrealizedConversionCastOp>(); 1415 - } 1416 - }; 1417 - @@ -69,7 +69,7 @@ struct FuncOpConversion : public FuncOpConversionBase { 1418 - : FuncOpConversionBase(converter, benefit), numWarps(numWarps) {} 1419 - 1420 - LogicalResult 1421 - - matchAndRewrite(FuncOp funcOp, OpAdaptor adaptor, 1422 - + matchAndRewrite(func::FuncOp funcOp, OpAdaptor adaptor, 1423 - ConversionPatternRewriter &rewriter) const override { 1424 - auto newFuncOp = convertFuncOpToLLVMFuncOp(funcOp, rewriter); 1425 - if (!newFuncOp) 1426 - @@ -133,7 +133,8 @@ class ConvertTritonGPUToLLVM 1427 - decomposeBlockedToDotOperand(mod); 1428 - 1429 - // Step 2 1430 - - decomposeInsertSliceAsyncOp(mod); 1431 - + if (failed(decomposeInsertSliceAsyncOp(mod))) 1432 - + return signalPassFailure(); 1433 - 1434 - // Step 3 1435 - Allocation allocation(mod); 1436 - @@ -142,7 +143,7 @@ class ConvertTritonGPUToLLVM 1437 - 1438 - // Step 4 1439 - RewritePatternSet scf_patterns(context); 1440 - - mlir::populateLoopToStdConversionPatterns(scf_patterns); 1441 - + mlir::populateSCFToControlFlowConversionPatterns(scf_patterns); 1442 - mlir::ConversionTarget scf_target(*context); 1443 - scf_target.addIllegalOp<scf::ForOp, scf::IfOp, scf::ParallelOp, 1444 - scf::WhileOp, scf::ExecuteRegionOp>(); 1445 - @@ -159,8 +160,10 @@ class ConvertTritonGPUToLLVM 1446 - return signalPassFailure(); 1447 - 1448 - // Step 6 - get axis and shared memory info 1449 - - AxisInfoAnalysis axisInfoAnalysis(mod.getContext()); 1450 - - axisInfoAnalysis.run(mod); 1451 - + std::unique_ptr<DataFlowSolver> solver = createDataFlowSolver(); 1452 - + AxisInfoAnalysis *axisInfoAnalysis = solver->load<AxisInfoAnalysis>(); 1453 - + if (failed(solver->initializeAndRun(mod))) 1454 - + return signalPassFailure(); 1455 - initSharedMemory(allocation.getSharedMemorySize(), typeConverter); 1456 - mod->setAttr("triton_gpu.shared", 1457 - mlir::IntegerAttr::get(mlir::IntegerType::get(context, 32), 1458 - @@ -178,38 +181,39 @@ class ConvertTritonGPUToLLVM 1459 - 1460 - // Normal conversions 1461 - populateTritonGPUToLLVMPatterns(typeConverter, patterns, numWarps, 1462 - - axisInfoAnalysis, &allocation, smem, 1463 - + *axisInfoAnalysis, &allocation, smem, 1464 - indexCacheInfo, /*benefit=*/10); 1465 - // ConvertLayoutOp 1466 - populateConvertLayoutOpToLLVMPatterns(typeConverter, patterns, numWarps, 1467 - - axisInfoAnalysis, &allocation, smem, 1468 - + *axisInfoAnalysis, &allocation, smem, 1469 - indexCacheInfo, /*benefit=*/10); 1470 - // DotOp 1471 - populateDotOpToLLVMPatterns(typeConverter, patterns, numWarps, 1472 - - axisInfoAnalysis, &allocation, smem, 1473 - + *axisInfoAnalysis, &allocation, smem, 1474 - /*benefit=*/10); 1475 - // ElementwiseOp 1476 - populateElementwiseOpToLLVMPatterns(typeConverter, patterns, numWarps, 1477 - - axisInfoAnalysis, &allocation, smem, 1478 - + *axisInfoAnalysis, &allocation, smem, 1479 - /*benefit=*/10); 1480 - // LoadStoreOp 1481 - populateLoadStoreOpToLLVMPatterns(typeConverter, patterns, numWarps, 1482 - - axisInfoAnalysis, &allocation, smem, 1483 - + *axisInfoAnalysis, &allocation, smem, 1484 - indexCacheInfo, /*benefit=*/10); 1485 - // ReduceOp 1486 - populateReduceOpToLLVMPatterns(typeConverter, patterns, numWarps, 1487 - - axisInfoAnalysis, &allocation, smem, 1488 - + *axisInfoAnalysis, &allocation, smem, 1489 - indexCacheInfo, /*benefit=*/10); 1490 - // ViewOp 1491 - populateViewOpToLLVMPatterns(typeConverter, patterns, numWarps, 1492 - - axisInfoAnalysis, &allocation, smem, 1493 - + *axisInfoAnalysis, &allocation, smem, 1494 - /*benefit=*/10); 1495 - 1496 - // Add arith/math's patterns to help convert scalar expression to LLVM. 1497 - mlir::arith::populateArithmeticToLLVMConversionPatterns(typeConverter, 1498 - patterns); 1499 - mlir::populateMathToLLVMConversionPatterns(typeConverter, patterns); 1500 - - mlir::populateStdToLLVMConversionPatterns(typeConverter, patterns); 1501 - + mlir::cf::populateControlFlowToLLVMConversionPatterns(typeConverter, 1502 - + patterns); 1503 - mlir::populateGpuToNVVMConversionPatterns(typeConverter, patterns); 1504 - 1505 - if (failed(applyPartialConversion(mod, target, std::move(patterns)))) 1506 - @@ -306,9 +310,11 @@ class ConvertTritonGPUToLLVM 1507 - }); 1508 - } 1509 - 1510 - - void decomposeInsertSliceAsyncOp(ModuleOp mod) const { 1511 - - AxisInfoAnalysis axisInfoAnalysis(mod.getContext()); 1512 - - axisInfoAnalysis.run(mod); 1513 - + LogicalResult decomposeInsertSliceAsyncOp(ModuleOp mod) const { 1514 - + std::unique_ptr<DataFlowSolver> solver = createDataFlowSolver(); 1515 - + AxisInfoAnalysis *axisInfoAnalysis = solver->load<AxisInfoAnalysis>(); 1516 - + if (failed(solver->initializeAndRun(mod))) 1517 - + return failure(); 1518 - // TODO(Keren): This is a hacky knob that may cause performance regression 1519 - // when decomposition has been performed. We should remove this knob once we 1520 - // have thorough analysis on async wait. Currently, we decompose 1521 - @@ -342,7 +348,7 @@ class ConvertTritonGPUToLLVM 1522 - auto resSharedLayout = 1523 - dstTy.getEncoding().dyn_cast<triton::gpu::SharedEncodingAttr>(); 1524 - auto resElemTy = dstTy.getElementType(); 1525 - - unsigned inVec = axisInfoAnalysis.getPtrContiguity(src); 1526 - + unsigned inVec = axisInfoAnalysis->getPtrContiguity(src); 1527 - unsigned outVec = resSharedLayout.getVec(); 1528 - unsigned minVec = std::min(outVec, inVec); 1529 - auto maxBitWidth = 1530 - @@ -400,11 +406,11 @@ class ConvertTritonGPUToLLVM 1531 - } else if (decomposed) { 1532 - // Wait for all previous async ops 1533 - OpBuilder builder(asyncWaitOp); 1534 - - auto newAsyncWaitOp = 1535 - - builder.create<triton::gpu::AsyncWaitOp>(asyncWaitOp.getLoc(), 0); 1536 - + builder.create<triton::gpu::AsyncWaitOp>(asyncWaitOp.getLoc(), 0); 1537 - asyncWaitOp.erase(); 1538 - } 1539 - }); 1540 - + return success(); 1541 - } 1542 - }; 1543 - 1544 - diff --git a/lib/Conversion/TritonGPUToLLVM/Utility.h b/lib/Conversion/TritonGPUToLLVM/Utility.h 1545 - index d35dac28c5..11976908cf 100644 1546 - --- a/lib/Conversion/TritonGPUToLLVM/Utility.h 1547 - +++ b/lib/Conversion/TritonGPUToLLVM/Utility.h 1548 - @@ -220,10 +220,7 @@ struct SharedMemoryObject { 1549 - ConversionPatternRewriter &rewriter) 1550 - : base(base) { 1551 - strides = getStridesFromShapeAndOrder(shape, order, loc, rewriter); 1552 - - 1553 - - for (auto idx : order) { 1554 - - offsets.emplace_back(i32_val(0)); 1555 - - } 1556 - + offsets.append(order.size(), i32_val(0)); 1557 - } 1558 - 1559 - SmallVector<Value> getElems() const { 1560 - diff --git a/lib/Conversion/TritonToTritonGPU/TritonToTritonGPUPass.cpp b/lib/Conversion/TritonToTritonGPU/TritonToTritonGPUPass.cpp 1561 - index fe42202c34..5f230f787f 100644 1562 - --- a/lib/Conversion/TritonToTritonGPU/TritonToTritonGPUPass.cpp 1563 - +++ b/lib/Conversion/TritonToTritonGPU/TritonToTritonGPUPass.cpp 1564 - @@ -1,10 +1,10 @@ 1565 - #include "triton/Conversion/TritonToTritonGPU/TritonToTritonGPUPass.h" 1566 - 1567 - #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h" 1568 - -#include "mlir/Dialect/GPU/GPUDialect.h" 1569 - +#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h" 1570 - +#include "mlir/Dialect/GPU/IR/GPUDialect.h" 1571 - #include "mlir/Dialect/LLVMIR/LLVMDialect.h" 1572 - #include "mlir/Dialect/LLVMIR/NVVMDialect.h" 1573 - -#include "mlir/Dialect/StandardOps/IR/Ops.h" 1574 - #include "mlir/Pass/Pass.h" 1575 - #include "mlir/Transforms/DialectConversion.h" 1576 - #include "triton/Dialect/Triton/IR/Dialect.h" 1577 - @@ -59,10 +59,13 @@ class ArithConstantPattern : public OpConversionPattern<arith::ConstantOp> { 1578 - Type retType = getTypeConverter()->convertType(op.getType()); 1579 - auto value = adaptor.getValue().dyn_cast<DenseElementsAttr>(); 1580 - assert(value); 1581 - - rewriter.replaceOpWithNewOp<arith::ConstantOp>( 1582 - - op, retType, 1583 - - value.reshape(retType) // This is a hack. We just want to add encoding 1584 - - ); 1585 - + if (value.getElementType().isInteger(1) && value.isSplat()) 1586 - + // Workaround until https://reviews.llvm.org/D133743 is included. 1587 - + value = DenseElementsAttr::get(retType, value.getSplatValue<bool>()); 1588 - + else 1589 - + // This is a hack. We just want to add encoding 1590 - + value = value.reshape(retType); 1591 - + rewriter.replaceOpWithNewOp<arith::ConstantOp>(op, retType, value); 1592 - return success(); 1593 - } 1594 - }; 1595 - @@ -127,12 +130,12 @@ void populateArithmeticPatternsAndLegality( 1596 - } 1597 - 1598 - // this shouldn't exist if mlir's SelectOp checked encodings properly 1599 - -class StdSelectPattern : public OpConversionPattern<SelectOp> { 1600 - +class StdSelectPattern : public OpConversionPattern<arith::SelectOp> { 1601 - public: 1602 - - using OpConversionPattern<SelectOp>::OpConversionPattern; 1603 - + using OpConversionPattern<arith::SelectOp>::OpConversionPattern; 1604 - 1605 - LogicalResult 1606 - - matchAndRewrite(SelectOp op, typename SelectOp::Adaptor adaptor, 1607 - + matchAndRewrite(arith::SelectOp op, OpAdaptor adaptor, 1608 - ConversionPatternRewriter &rewriter) const override { 1609 - Type retType = this->getTypeConverter()->convertType(op.getType()); 1610 - rewriter.replaceOpWithNewOp<triton::gpu::SelectOp>( 1611 - @@ -148,8 +151,8 @@ void populateStdPatternsAndLegality(TritonGPUTypeConverter &typeConverter, 1612 - MLIRContext *context = patterns.getContext(); 1613 - // Rewrite rule 1614 - patterns.add<StdSelectPattern>(typeConverter, context); 1615 - - target.addLegalOp<ReturnOp>(); // this is ok because all functions are inlined 1616 - - // by the frontend 1617 - + target.addLegalOp<func::ReturnOp>(); // this is ok because all functions are 1618 - + // inlined by the frontend 1619 - } 1620 - 1621 - void populateMathPatternsAndLegality(TritonGPUTypeConverter &typeConverter, 1622 - @@ -455,18 +458,19 @@ struct TritonPrintfPattern : public OpConversionPattern<triton::PrintfOp> { 1623 - void populateTritonPatterns(TritonGPUTypeConverter &typeConverter, 1624 - RewritePatternSet &patterns) { 1625 - MLIRContext *context = patterns.getContext(); 1626 - - patterns.add< // TODO: view should have custom pattern that views the layout 1627 - - TritonGenericPattern<triton::ViewOp>, 1628 - - TritonGenericPattern<triton::BitcastOp>, 1629 - - TritonGenericPattern<triton::FpToFpOp>, 1630 - - TritonGenericPattern<triton::IntToPtrOp>, 1631 - - TritonGenericPattern<triton::PtrToIntOp>, 1632 - - TritonGenericPattern<triton::SplatOp>, TritonBroadcastPattern, 1633 - - TritonGenericPattern<triton::AddPtrOp>, TritonCatPattern, 1634 - - TritonReducePattern, TritonTransPattern, TritonExpandDimsPattern, 1635 - - TritonMakeRangePattern, TritonDotPattern, TritonLoadPattern, 1636 - - TritonStorePattern, TritonExtElemwisePattern, TritonPrintfPattern, 1637 - - TritonAtomicRMWPattern>(typeConverter, context); 1638 - + patterns 1639 - + .insert< // TODO: view should have custom pattern that views the layout 1640 - + TritonGenericPattern<triton::ViewOp>, 1641 - + TritonGenericPattern<triton::BitcastOp>, 1642 - + TritonGenericPattern<triton::FpToFpOp>, 1643 - + TritonGenericPattern<triton::IntToPtrOp>, 1644 - + TritonGenericPattern<triton::PtrToIntOp>, 1645 - + TritonGenericPattern<triton::SplatOp>, TritonBroadcastPattern, 1646 - + TritonGenericPattern<triton::AddPtrOp>, TritonCatPattern, 1647 - + TritonReducePattern, TritonTransPattern, TritonExpandDimsPattern, 1648 - + TritonMakeRangePattern, TritonDotPattern, TritonLoadPattern, 1649 - + TritonStorePattern, TritonExtElemwisePattern, TritonPrintfPattern, 1650 - + TritonAtomicRMWPattern>(typeConverter, context); 1651 - } 1652 - 1653 - // 1654 - @@ -623,29 +627,28 @@ void populateSCFPatterns(TritonGPUTypeConverter &typeConverter, 1655 - 1656 - // CF 1657 - 1658 - -class CFBranchPattern : public OpConversionPattern<BranchOp> { 1659 - +class CFBranchPattern : public OpConversionPattern<cf::BranchOp> { 1660 - public: 1661 - - using OpConversionPattern<BranchOp>::OpConversionPattern; 1662 - + using OpConversionPattern<cf::BranchOp>::OpConversionPattern; 1663 - 1664 - LogicalResult 1665 - - matchAndRewrite(BranchOp op, BranchOp::Adaptor adaptor, 1666 - + matchAndRewrite(cf::BranchOp op, cf::BranchOp::Adaptor adaptor, 1667 - ConversionPatternRewriter &rewriter) const override { 1668 - - auto converter = getTypeConverter(); 1669 - - auto newOp = rewriter.replaceOpWithNewOp<BranchOp>(op, op.getSuccessor(), 1670 - - adaptor.getOperands()); 1671 - + auto newOp = rewriter.replaceOpWithNewOp<cf::BranchOp>( 1672 - + op, op.getSuccessor(), adaptor.getOperands()); 1673 - return success(); 1674 - } 1675 - }; 1676 - 1677 - -class CFCondBranchPattern : public OpConversionPattern<CondBranchOp> { 1678 - +class CFCondBranchPattern : public OpConversionPattern<cf::CondBranchOp> { 1679 - public: 1680 - - using OpConversionPattern<CondBranchOp>::OpConversionPattern; 1681 - + using OpConversionPattern<cf::CondBranchOp>::OpConversionPattern; 1682 - 1683 - LogicalResult 1684 - - matchAndRewrite(CondBranchOp op, CondBranchOp::Adaptor adaptor, 1685 - + matchAndRewrite(cf::CondBranchOp op, cf::CondBranchOp::Adaptor adaptor, 1686 - ConversionPatternRewriter &rewriter) const override { 1687 - auto converter = getTypeConverter(); 1688 - - auto newOp = rewriter.replaceOpWithNewOp<CondBranchOp>( 1689 - + auto newOp = rewriter.replaceOpWithNewOp<cf::CondBranchOp>( 1690 - op, adaptor.getCondition(), op.getTrueDest(), 1691 - adaptor.getTrueDestOperands(), op.getFalseDest(), 1692 - adaptor.getFalseDestOperands()); 1693 - diff --git a/lib/Dialect/Triton/IR/CMakeLists.txt b/lib/Dialect/Triton/IR/CMakeLists.txt 1694 - index 2d679b21fd..705554ba6b 100644 1695 - --- a/lib/Dialect/Triton/IR/CMakeLists.txt 1696 - +++ b/lib/Dialect/Triton/IR/CMakeLists.txt 1697 - @@ -10,11 +10,7 @@ add_mlir_dialect_library(TritonIR 1698 - 1699 - LINK_LIBS PUBLIC 1700 - MLIRIR 1701 - - MLIRArithmetic 1702 - - MLIRSCF 1703 - - 1704 - - # Since LLVM 15 1705 - - # MLIRFunc 1706 - - # else 1707 - - MLIRStandard 1708 - + MLIRArithmeticDialect 1709 - + MLIRSCFDialect 1710 - + MLIRFuncDialect 1711 - ) 1712 - diff --git a/lib/Dialect/Triton/IR/Ops.cpp b/lib/Dialect/Triton/IR/Ops.cpp 1713 - index 3aadbfa0c0..86570359c5 100644 1714 - --- a/lib/Dialect/Triton/IR/Ops.cpp 1715 - +++ b/lib/Dialect/Triton/IR/Ops.cpp 1716 - @@ -1,10 +1,9 @@ 1717 - -#include "triton/Dialect/Triton/IR/Dialect.h" 1718 - -#include "triton/Dialect/Triton/IR/Types.h" 1719 - - 1720 - #include "mlir/IR/Builders.h" 1721 - #include "mlir/IR/BuiltinAttributes.h" 1722 - #include "mlir/IR/BuiltinTypes.h" 1723 - #include "mlir/IR/OperationSupport.h" 1724 - +#include "triton/Dialect/Triton/IR/Dialect.h" 1725 - +#include "triton/Dialect/Triton/IR/Types.h" 1726 - 1727 - namespace mlir { 1728 - namespace triton { 1729 - @@ -38,8 +37,8 @@ static Type getPointerTypeSameShape(Type type) { 1730 - } 1731 - 1732 - // Parser & printer for assembly forms 1733 - -ParseResult parseLoadOp(OpAsmParser &parser, OperationState &result) { 1734 - - SmallVector<OpAsmParser::OperandType, 4> allOperands; 1735 - +ParseResult LoadOp::parse(OpAsmParser &parser, OperationState &result) { 1736 - + SmallVector<OpAsmParser::UnresolvedOperand, 4> allOperands; 1737 - Type resultTypes[1]; 1738 - SMLoc allOperandLoc = parser.getCurrentLocation(); 1739 - if (parser.parseOperandList(allOperands) || 1740 - @@ -73,18 +72,18 @@ ParseResult parseLoadOp(OpAsmParser &parser, OperationState &result) { 1741 - return success(); 1742 - } 1743 - 1744 - -void printLoadOp(OpAsmPrinter &printer, LoadOp loadOp) { 1745 - +void LoadOp::print(OpAsmPrinter &printer) { 1746 - printer << " "; 1747 - - printer << loadOp.getOperation()->getOperands(); 1748 - + printer << getOperation()->getOperands(); 1749 - // "operand_segment_sizes" can be deduced, so we don't print it. 1750 - - printer.printOptionalAttrDict(loadOp->getAttrs(), 1751 - - {loadOp.operand_segment_sizesAttrName()}); 1752 - + printer.printOptionalAttrDict(getOperation()->getAttrs(), 1753 - + {operand_segment_sizesAttrName()}); 1754 - printer << " : "; 1755 - - printer.printStrippedAttrOrType(loadOp.result().getType()); 1756 - + printer.printStrippedAttrOrType(getResult().getType()); 1757 - } 1758 - 1759 - -ParseResult parseStoreOp(OpAsmParser &parser, OperationState &result) { 1760 - - SmallVector<OpAsmParser::OperandType, 4> allOperands; 1761 - +ParseResult StoreOp::parse(OpAsmParser &parser, OperationState &result) { 1762 - + SmallVector<OpAsmParser::UnresolvedOperand, 4> allOperands; 1763 - Type valueType; 1764 - SMLoc allOperandLoc = parser.getCurrentLocation(); 1765 - if (parser.parseOperandList(allOperands) || 1766 - @@ -104,12 +103,12 @@ ParseResult parseStoreOp(OpAsmParser &parser, OperationState &result) { 1767 - return success(); 1768 - } 1769 - 1770 - -void printStoreOp(OpAsmPrinter &printer, StoreOp storeOp) { 1771 - +void StoreOp::print(OpAsmPrinter &printer) { 1772 - printer << " "; 1773 - - printer << storeOp.getOperation()->getOperands(); 1774 - - printer.printOptionalAttrDict(storeOp->getAttrs(), /*elidedAttrs=*/{}); 1775 - + printer << getOperation()->getOperands(); 1776 - + printer.printOptionalAttrDict(getOperation()->getAttrs(), /*elidedAttrs=*/{}); 1777 - printer << " : "; 1778 - - printer.printStrippedAttrOrType(storeOp.value().getType()); 1779 - + printer.printStrippedAttrOrType(value().getType()); 1780 - } 1781 - 1782 - } // namespace triton 1783 - @@ -319,7 +318,8 @@ OpFoldResult SplatOp::fold(ArrayRef<Attribute> operands) { 1784 - if (!constOperand) 1785 - return {}; 1786 - auto shapedType = getType().cast<ShapedType>(); 1787 - - auto ret = SplatElementsAttr::get(shapedType, {constOperand.getValue()}); 1788 - + auto ret = SplatElementsAttr::get( 1789 - + shapedType, ArrayRef<Attribute>(constOperand.getValue())); 1790 - return ret; 1791 - } 1792 - 1793 - diff --git a/lib/Dialect/Triton/Transforms/Combine.cpp b/lib/Dialect/Triton/Transforms/Combine.cpp 1794 - index 2261472170..11570283d6 100644 1795 - --- a/lib/Dialect/Triton/Transforms/Combine.cpp 1796 - +++ b/lib/Dialect/Triton/Transforms/Combine.cpp 1797 - @@ -57,13 +57,13 @@ DenseElementsAttr getConstantValue(Builder &builder, Attribute value, 1798 - class CombineSelectMaskedLoadPattern : public mlir::RewritePattern { 1799 - public: 1800 - CombineSelectMaskedLoadPattern(mlir::MLIRContext *context) 1801 - - : mlir::RewritePattern(mlir::SelectOp::getOperationName(), 3, context, 1802 - - {triton::LoadOp::getOperationName()}) {} 1803 - + : mlir::RewritePattern(mlir::arith::SelectOp::getOperationName(), 3, 1804 - + context, {triton::LoadOp::getOperationName()}) {} 1805 - 1806 - mlir::LogicalResult 1807 - matchAndRewrite(mlir::Operation *op, 1808 - mlir::PatternRewriter &rewriter) const override { 1809 - - auto selectOp = llvm::dyn_cast<mlir::SelectOp>(op); 1810 - + auto selectOp = llvm::dyn_cast<mlir::arith::SelectOp>(op); 1811 - if (!selectOp) 1812 - return mlir::failure(); 1813 - 1814 - diff --git a/lib/Dialect/Triton/Transforms/Combine.td b/lib/Dialect/Triton/Transforms/Combine.td 1815 - index 14f286b26e..ded0e346e6 100644 1816 - --- a/lib/Dialect/Triton/Transforms/Combine.td 1817 - +++ b/lib/Dialect/Triton/Transforms/Combine.td 1818 - @@ -1,9 +1,9 @@ 1819 - #ifndef TRITON_PATTERNS 1820 - #define TRITON_PATTERNS 1821 - 1822 - -include "mlir/Dialect/StandardOps/IR/Ops.td" 1823 - include "mlir/Dialect/Arithmetic/IR/ArithmeticOps.td" 1824 - include "triton/Dialect/Triton/IR/TritonOps.td" 1825 - +include "mlir/IR/PatternBase.td" 1826 - 1827 - 1828 - // AddIOp(DotOp(a, b, c), d) and c==0 => DotOp(a, b, d) 1829 - diff --git a/lib/Dialect/TritonGPU/IR/Dialect.cpp b/lib/Dialect/TritonGPU/IR/Dialect.cpp 1830 - index 1fbc609e88..bfc3f3d3da 100644 1831 - --- a/lib/Dialect/TritonGPU/IR/Dialect.cpp 1832 - +++ b/lib/Dialect/TritonGPU/IR/Dialect.cpp 1833 - @@ -1,14 +1,14 @@ 1834 - +#include "triton/Dialect/Triton/IR/Dialect.h" 1835 - + 1836 - #include <numeric> 1837 - 1838 - #include "mlir/IR/DialectImplementation.h" 1839 - #include "mlir/IR/OpImplementation.h" 1840 - #include "triton/Analysis/Utility.h" 1841 - -#include "triton/Dialect/Triton/IR/Dialect.h" 1842 - +#include "triton/Dialect/TritonGPU/IR/Dialect.cpp.inc" 1843 - #include "triton/Dialect/TritonGPU/IR/Dialect.h" 1844 - #include "llvm/ADT/TypeSwitch.h" 1845 - 1846 - -#include "triton/Dialect/TritonGPU/IR/Dialect.cpp.inc" 1847 - - 1848 - using namespace mlir; 1849 - using namespace mlir::triton::gpu; 1850 - 1851 - @@ -366,7 +366,6 @@ template SmallVector<int64_t> 1852 - SliceEncodingAttr::paddedShape<int64_t>(ArrayRef<int64_t> shape) const; 1853 - 1854 - unsigned SliceEncodingAttr::getElemsPerThread(ArrayRef<int64_t> shape) const { 1855 - - size_t rank = shape.size(); 1856 - auto parent = getParent(); 1857 - return ::getElemsPerThread(parent, paddedShape(shape)); 1858 - } 1859 - @@ -655,9 +654,9 @@ void DotOperandEncodingAttr::print(mlir::AsmPrinter &printer) const { 1860 - // InsertSliceAsyncOp 1861 - //===----------------------------------------------------------------------===// 1862 - 1863 - -ParseResult parseInsertSliceAsyncOp(OpAsmParser &parser, 1864 - - OperationState &result) { 1865 - - SmallVector<OpAsmParser::OperandType, 8> allOperands; 1866 - +ParseResult InsertSliceAsyncOp::parse(OpAsmParser &parser, 1867 - + OperationState &result) { 1868 - + SmallVector<OpAsmParser::UnresolvedOperand, 8> allOperands; 1869 - Type srcType, dstType; 1870 - SMLoc allOperandLoc = parser.getCurrentLocation(); 1871 - if (parser.parseOperandList(allOperands) || 1872 - @@ -696,18 +695,16 @@ ParseResult parseInsertSliceAsyncOp(OpAsmParser &parser, 1873 - return success(); 1874 - } 1875 - 1876 - -void printInsertSliceAsyncOp(OpAsmPrinter &printer, 1877 - - InsertSliceAsyncOp insertSliceAsyncOp) { 1878 - +void InsertSliceAsyncOp::print(OpAsmPrinter &printer) { 1879 - printer << " "; 1880 - - printer << insertSliceAsyncOp.getOperation()->getOperands(); 1881 - + printer << getOperation()->getOperands(); 1882 - // "operand_segment_sizes" can be deduced, so we don't print it. 1883 - - printer.printOptionalAttrDict( 1884 - - insertSliceAsyncOp->getAttrs(), 1885 - - {insertSliceAsyncOp.operand_segment_sizesAttrName()}); 1886 - + printer.printOptionalAttrDict(getOperation()->getAttrs(), 1887 - + {operand_segment_sizesAttrName()}); 1888 - printer << " : "; 1889 - - printer.printStrippedAttrOrType(insertSliceAsyncOp.src().getType()); 1890 - + printer.printStrippedAttrOrType(src().getType()); 1891 - printer << " -> "; 1892 - - printer.printStrippedAttrOrType(insertSliceAsyncOp.result().getType()); 1893 - + printer.printStrippedAttrOrType(result().getType()); 1894 - } 1895 - 1896 - //===----------------------------------------------------------------------===// 1897 - diff --git a/lib/Dialect/TritonGPU/Transforms/Coalesce.cpp b/lib/Dialect/TritonGPU/Transforms/Coalesce.cpp 1898 - index 82407980d3..ee6009f44a 100644 1899 - --- a/lib/Dialect/TritonGPU/Transforms/Coalesce.cpp 1900 - +++ b/lib/Dialect/TritonGPU/Transforms/Coalesce.cpp 1901 - @@ -27,7 +27,11 @@ struct CoalescePass : public TritonGPUCoalesceBase<CoalescePass> { 1902 - auto origType = ptr.getType().cast<RankedTensorType>(); 1903 - // Get the shape of the tensor. 1904 - size_t rank = origType.getRank(); 1905 - - AxisInfo info = axisInfo.lookupLatticeElement(ptr)->getValue(); 1906 - + dataflow::Lattice<AxisInfo> *latticeElement = 1907 - + axisInfo.getLatticeElement(ptr); 1908 - + AxisInfo info = latticeElement && !latticeElement->isUninitialized() 1909 - + ? latticeElement->getValue() 1910 - + : AxisInfo(); 1911 - // Get the contiguity order of `ptr` 1912 - auto order = argSort(info.getContiguity()); 1913 - // The desired divisibility is the maximum divisibility 1914 - @@ -40,7 +44,7 @@ struct CoalescePass : public TritonGPUCoalesceBase<CoalescePass> { 1915 - for (Value val : op->getResults()) { 1916 - if (val.getType() != origType) 1917 - continue; 1918 - - auto valInfo = axisInfo.lookupLatticeElement(val); 1919 - + auto valInfo = axisInfo.getLatticeElement(val); 1920 - auto currOrder = argSort(valInfo->getValue().getContiguity()); 1921 - if (order == currOrder) 1922 - withSameOrder.insert(val); 1923 - @@ -55,7 +59,7 @@ struct CoalescePass : public TritonGPUCoalesceBase<CoalescePass> { 1924 - unsigned elemNumBytes = std::max(elemNumBits / 8, 1u); 1925 - unsigned perThread = 1; 1926 - for (Value val : withSameOrder) { 1927 - - AxisInfo info = axisInfo.lookupLatticeElement(val)->getValue(); 1928 - + AxisInfo info = axisInfo.getLatticeElement(val)->getValue(); 1929 - unsigned maxMultipleBytes = info.getDivisibility(order[0]); 1930 - unsigned maxMultiple = std::max(maxMultipleBytes / elemNumBytes, 1u); 1931 - unsigned maxContig = info.getContiguity(order[0]); 1932 - @@ -123,8 +127,10 @@ struct CoalescePass : public TritonGPUCoalesceBase<CoalescePass> { 1933 - void runOnOperation() override { 1934 - Operation *op = getOperation(); 1935 - // Run axis info analysis 1936 - - AxisInfoAnalysis axisInfo(&getContext()); 1937 - - axisInfo.run(op); 1938 - + std::unique_ptr<DataFlowSolver> solver = createDataFlowSolver(); 1939 - + AxisInfoAnalysis *axisInfo = solver->load<AxisInfoAnalysis>(); 1940 - + if (failed(solver->initializeAndRun(op))) 1941 - + return signalPassFailure(); 1942 - 1943 - // For each i/o operation, we determine what layout 1944 - // the pointers should have for best memory coalescing 1945 - @@ -146,10 +152,10 @@ struct CoalescePass : public TritonGPUCoalesceBase<CoalescePass> { 1946 - RankedTensorType ty = ptr.getType().template dyn_cast<RankedTensorType>(); 1947 - if (!ty || !ty.getElementType().isa<PointerType>()) 1948 - return; 1949 - - AxisInfo info = axisInfo.lookupLatticeElement(ptr)->getValue(); 1950 - + AxisInfo info = axisInfo->getLatticeElement(ptr)->getValue(); 1951 - auto mod = curr->getParentOfType<ModuleOp>(); 1952 - int numWarps = triton::gpu::TritonGPUDialect::getNumWarps(mod); 1953 - - auto convertType = getTypeConverter(axisInfo, ptr, numWarps); 1954 - + auto convertType = getTypeConverter(*axisInfo, ptr, numWarps); 1955 - layoutMap[ptr] = convertType; 1956 - }); 1957 - 1958 - diff --git a/lib/Dialect/TritonGPU/Transforms/Combine.cpp b/lib/Dialect/TritonGPU/Transforms/Combine.cpp 1959 - index efa37ff2dc..089ce3996c 100644 1960 - --- a/lib/Dialect/TritonGPU/Transforms/Combine.cpp 1961 - +++ b/lib/Dialect/TritonGPU/Transforms/Combine.cpp 1962 - @@ -1,6 +1,6 @@ 1963 - #include "Utility.h" 1964 - #include "mlir/Analysis/SliceAnalysis.h" 1965 - -#include "mlir/Dialect/SCF/SCF.h" 1966 - +#include "mlir/Dialect/SCF/IR/SCF.h" 1967 - #include "mlir/IR/BlockAndValueMapping.h" 1968 - #include "mlir/IR/BuiltinAttributes.h" 1969 - #include "mlir/IR/Matchers.h" 1970 - diff --git a/lib/Dialect/TritonGPU/Transforms/Combine.td b/lib/Dialect/TritonGPU/Transforms/Combine.td 1971 - index 6bf1b14866..6a7b10dbcb 100644 1972 - --- a/lib/Dialect/TritonGPU/Transforms/Combine.td 1973 - +++ b/lib/Dialect/TritonGPU/Transforms/Combine.td 1974 - @@ -3,5 +3,6 @@ 1975 - 1976 - include "triton/Dialect/TritonGPU/IR/TritonGPUOps.td" 1977 - include "triton/Dialect/Triton/IR/TritonOps.td" 1978 - +include "mlir/IR/PatternBase.td" 1979 - 1980 - #endif 1981 - diff --git a/lib/Dialect/TritonGPU/Transforms/DecomposeConversions.cpp b/lib/Dialect/TritonGPU/Transforms/DecomposeConversions.cpp 1982 - index 4bd3bc76bf..b2f8defd81 100644 1983 - --- a/lib/Dialect/TritonGPU/Transforms/DecomposeConversions.cpp 1984 - +++ b/lib/Dialect/TritonGPU/Transforms/DecomposeConversions.cpp 1985 - @@ -1,5 +1,5 @@ 1986 - #include "mlir/Analysis/SliceAnalysis.h" 1987 - -#include "mlir/Dialect/SCF/SCF.h" 1988 - +#include "mlir/Dialect/SCF/IR/SCF.h" 1989 - #include "mlir/IR/BlockAndValueMapping.h" 1990 - #include "mlir/IR/BuiltinAttributes.h" 1991 - #include "mlir/IR/Matchers.h" 1992 - diff --git a/lib/Dialect/TritonGPU/Transforms/Pipeline.cpp b/lib/Dialect/TritonGPU/Transforms/Pipeline.cpp 1993 - index 9b2f42231e..85f746c1dc 100644 1994 - --- a/lib/Dialect/TritonGPU/Transforms/Pipeline.cpp 1995 - +++ b/lib/Dialect/TritonGPU/Transforms/Pipeline.cpp 1996 - @@ -2,6 +2,7 @@ 1997 - #include "mlir/IR/BlockAndValueMapping.h" 1998 - #include "mlir/IR/TypeUtilities.h" 1999 - #include "triton/Analysis/AxisInfo.h" 2000 - +#include "triton/Analysis/Utility.h" 2001 - #include "triton/Dialect/TritonGPU/IR/Dialect.h" 2002 - #include "triton/Dialect/TritonGPU/Transforms/Passes.h" 2003 - 2004 - @@ -160,15 +161,18 @@ ttg::AllocTensorOp LoopPipeliner::allocateEmptyBuffer(Operation *op, 2005 - LogicalResult LoopPipeliner::initialize() { 2006 - Block *loop = forOp.getBody(); 2007 - 2008 - - AxisInfoAnalysis axisInfoAnalysis(forOp.getContext()); 2009 - - axisInfoAnalysis.run(forOp->getParentOfType<ModuleOp>()); 2010 - + std::unique_ptr<DataFlowSolver> solver = createDataFlowSolver(); 2011 - + AxisInfoAnalysis *axisInfoAnalysis = solver->load<AxisInfoAnalysis>(); 2012 - + if (failed(solver->initializeAndRun(forOp->getParentOfType<ModuleOp>()))) { 2013 - + return failure(); 2014 - + } 2015 - 2016 - // can we use forOp.walk(...) here? 2017 - SmallVector<triton::LoadOp, 2> allLoads; 2018 - for (Operation &op : *loop) 2019 - if (auto loadOp = dyn_cast<triton::LoadOp>(&op)) { 2020 - auto ptr = loadOp.ptr(); 2021 - - unsigned vec = axisInfoAnalysis.getPtrContiguity(ptr); 2022 - + unsigned vec = axisInfoAnalysis->getPtrContiguity(ptr); 2023 - auto tensorTy = ptr.getType().dyn_cast<RankedTensorType>(); 2024 - if (!tensorTy) 2025 - continue; 2026 - diff --git a/lib/Dialect/TritonGPU/Transforms/ReorderInstructions.cpp b/lib/Dialect/TritonGPU/Transforms/ReorderInstructions.cpp 2027 - index 0e7dbe5264..b95a4f50a6 100644 2028 - --- a/lib/Dialect/TritonGPU/Transforms/ReorderInstructions.cpp 2029 - +++ b/lib/Dialect/TritonGPU/Transforms/ReorderInstructions.cpp 2030 - @@ -1,5 +1,5 @@ 2031 - #include "mlir/Analysis/SliceAnalysis.h" 2032 - -#include "mlir/Dialect/SCF/SCF.h" 2033 - +#include "mlir/Dialect/SCF/IR/SCF.h" 2034 - #include "mlir/IR/BlockAndValueMapping.h" 2035 - #include "mlir/IR/BuiltinAttributes.h" 2036 - #include "mlir/IR/Matchers.h" 2037 - diff --git a/lib/Dialect/TritonGPU/Transforms/TritonGPUConversion.cpp b/lib/Dialect/TritonGPU/Transforms/TritonGPUConversion.cpp 2038 - index 37ac710995..762e887f36 100644 2039 - --- a/lib/Dialect/TritonGPU/Transforms/TritonGPUConversion.cpp 2040 - +++ b/lib/Dialect/TritonGPU/Transforms/TritonGPUConversion.cpp 2041 - @@ -82,12 +82,12 @@ TritonGPUConversionTarget::TritonGPUConversionTarget( 2042 - scf::ReduceReturnOp>(); 2043 - 2044 - addDynamicallyLegalDialect<arith::ArithmeticDialect, math::MathDialect, 2045 - - triton::TritonDialect, StandardOpsDialect, 2046 - - scf::SCFDialect>([&](Operation *op) { 2047 - - if (typeConverter.isLegal(op)) 2048 - - return true; 2049 - - return false; 2050 - - }); 2051 - + triton::TritonDialect, scf::SCFDialect>( 2052 - + [&](Operation *op) { 2053 - + if (typeConverter.isLegal(op)) 2054 - + return true; 2055 - + return false; 2056 - + }); 2057 - 2058 - // We have requirements for the data layouts 2059 - addDynamicallyLegalOp<triton::DotOp>([](triton::DotOp dotOp) -> bool { 2060 - diff --git a/lib/Dialect/TritonGPU/Transforms/UpdateMmaForVolta.cpp b/lib/Dialect/TritonGPU/Transforms/UpdateMmaForVolta.cpp 2061 - index c229104286..c911fd4a5c 100644 2062 - --- a/lib/Dialect/TritonGPU/Transforms/UpdateMmaForVolta.cpp 2063 - +++ b/lib/Dialect/TritonGPU/Transforms/UpdateMmaForVolta.cpp 2064 - @@ -1,5 +1,5 @@ 2065 - #include "Utility.h" 2066 - -#include "mlir/Dialect/SCF/SCF.h" 2067 - +#include "mlir/Dialect/SCF/IR/SCF.h" 2068 - #include "mlir/IR/Matchers.h" 2069 - #include "mlir/IR/PatternMatch.h" 2070 - #include "mlir/Transforms/GreedyPatternRewriteDriver.h" 2071 - @@ -118,8 +118,8 @@ void setOpResultType(Operation *op, ArrayRef<Type> newTypes) { 2072 - .get("value") 2073 - .dyn_cast<mlir::DenseElementsAttr>(); 2074 - if (attr) { 2075 - - auto newAttr = mlir::DenseElementsAttr::getFromRawBuffer( 2076 - - newType, attr.getRawData(), true); 2077 - + auto newAttr = 2078 - + mlir::DenseElementsAttr::getFromRawBuffer(newType, attr.getRawData()); 2079 - op->setAttr("value", newAttr); 2080 - } 2081 - } 2082 - diff --git a/lib/Dialect/TritonGPU/Transforms/Utility.cpp b/lib/Dialect/TritonGPU/Transforms/Utility.cpp 2083 - index ed15f02f67..6400f1633a 100644 2084 - --- a/lib/Dialect/TritonGPU/Transforms/Utility.cpp 2085 - +++ b/lib/Dialect/TritonGPU/Transforms/Utility.cpp 2086 - @@ -1,5 +1,5 @@ 2087 - #include "Utility.h" 2088 - -#include "mlir/Dialect/SCF/SCF.h" 2089 - +#include "mlir/Dialect/SCF/IR/SCF.h" 2090 - #include "mlir/IR/BlockAndValueMapping.h" 2091 - #include "mlir/Transforms/GreedyPatternRewriteDriver.h" 2092 - 2093 - diff --git a/lib/Target/LLVMIR/CMakeLists.txt b/lib/Target/LLVMIR/CMakeLists.txt 2094 - index f1bbd0bf4e..ac8973ad19 100644 2095 - --- a/lib/Target/LLVMIR/CMakeLists.txt 2096 - +++ b/lib/Target/LLVMIR/CMakeLists.txt 2097 - @@ -6,8 +6,7 @@ add_mlir_translation_library(TritonLLVMIR 2098 - 2099 - LINK_LIBS PUBLIC 2100 - MLIRIR 2101 - - MLIRLLVMIR 2102 - - MLIRSCFToStandard 2103 - + MLIRLLVMDialect 2104 - MLIRSupport 2105 - MLIRTargetLLVMIRExport 2106 - ) 2107 - diff --git a/lib/Target/PTX/PTXTranslation.cpp b/lib/Target/PTX/PTXTranslation.cpp 2108 - index 4cb0d8193c..6a5453a6e7 100644 2109 - --- a/lib/Target/PTX/PTXTranslation.cpp 2110 - +++ b/lib/Target/PTX/PTXTranslation.cpp 2111 - @@ -1,11 +1,14 @@ 2112 - #include "triton/Target/PTX/PTXTranslation.h" 2113 - #include "triton/Target/LLVMIR/LLVMIRTranslation.h" 2114 - +#include <optional> 2115 - 2116 - #include "llvm/IR/IRBuilder.h" 2117 - #include "llvm/IR/LegacyPassManager.h" 2118 - #include "llvm/IR/Module.h" 2119 - #include "llvm/IR/Verifier.h" 2120 - #include "llvm/MC/TargetRegistry.h" 2121 - +#include "llvm/Pass.h" 2122 - +#include "llvm/Support/CommandLine.h" 2123 - #include "llvm/Support/TargetSelect.h" 2124 - #include "llvm/Target/TargetMachine.h" 2125 - 2126 - diff --git a/python/setup.py b/python/setup.py 2127 - index 2ac3accd25..4530b36714 100644 2128 - --- a/python/setup.py 2129 - +++ b/python/setup.py 2130 - @@ -57,19 +57,10 @@ def get_pybind11_package_info(): 2131 - def get_llvm_package_info(): 2132 - # download if nothing is installed 2133 - system = platform.system() 2134 - - if system == "Darwin": 2135 - - system_suffix = "apple-darwin" 2136 - - elif system == "Linux": 2137 - - vglibc = tuple(map(int, platform.libc_ver()[1].split('.'))) 2138 - - vglibc = vglibc[0] * 100 + vglibc[1] 2139 - - linux_suffix = 'ubuntu-18.04' if vglibc > 217 else 'centos-7' 2140 - - system_suffix = f"linux-gnu-{linux_suffix}" 2141 - - else: 2142 - - raise RuntimeError(f"unsupported system: {system}") 2143 - + system_suffix = {"Linux": "linux-gnu-ubuntu-18.04", "Darwin": "apple-darwin"}[system] 2144 - use_assert_enabled_llvm = check_env_flag("TRITON_USE_ASSERT_ENABLED_LLVM", "False") 2145 - - release_suffix = "assert" if use_assert_enabled_llvm else "release" 2146 - - name = f'llvm+mlir-14.0.6-x86_64-{system_suffix}-{release_suffix}' 2147 - - url = f"https://github.com/ptillet/triton-llvm-releases/releases/download/llvm-14.0.6-f28c006a5895/{name}.tar.xz" 2148 - + name = 'llvm+mlir-15.0.7-x86_64-{}-{}'.format(system_suffix, "assert" if use_assert_enabled_llvm else "release") 2149 - + url = "https://github.com/ptillet/triton-llvm-releases/releases/download/llvm-15.0.7-8dfdcc7b7bf6/{}.tar.xz".format(name) 2150 - return Package("llvm", name, url, "lib", "LLVM_INCLUDE_DIRS", "LLVM_LIBRARY_DIR", "LLVM_SYSPATH") 2151 - 2152 - 2153 - diff --git a/python/src/triton.cc b/python/src/triton.cc 2154 - index c40b117a55..f190eacc34 100644 2155 - --- a/python/src/triton.cc 2156 - +++ b/python/src/triton.cc 2157 - @@ -8,9 +8,10 @@ 2158 - #include "mlir/Pass/PassManager.h" 2159 - #include "mlir/Transforms/Passes.h" 2160 - 2161 - -#include "mlir/Parser.h" 2162 - +#include "mlir/Parser/Parser.h" 2163 - #include "mlir/Support/FileUtilities.h" 2164 - 2165 - +#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h" 2166 - #include "mlir/Dialect/LLVMIR/LLVMDialect.h" 2167 - #include "triton/Analysis/Allocation.h" 2168 - #include "triton/Conversion/TritonGPUToLLVM/TritonGPUToLLVMPass.h" 2169 - @@ -195,7 +196,7 @@ void init_triton_ir(py::module &&m) { 2170 - std::string attrName = name + "_arg" + std::to_string(id); 2171 - mlir::Block *owner = arg.getOwner(); 2172 - if (owner->isEntryBlock() && 2173 - - !mlir::isa<mlir::FuncOp>(owner->getParentOp())) { 2174 - + !mlir::isa<mlir::func::FuncOp>(owner->getParentOp())) { 2175 - owner->getParentOp()->setAttr(attrName, attr); 2176 - } 2177 - } 2178 - @@ -348,7 +349,7 @@ void init_triton_ir(py::module &&m) { 2179 - return str; 2180 - }) 2181 - .def("push_back", 2182 - - [](mlir::ModuleOp &self, mlir::FuncOp &funcOp) -> void { 2183 - + [](mlir::ModuleOp &self, mlir::func::FuncOp &funcOp) -> void { 2184 - self.push_back(funcOp); 2185 - }) 2186 - .def("has_function", 2187 - @@ -358,16 +359,18 @@ void init_triton_ir(py::module &&m) { 2188 - return false; 2189 - }) 2190 - .def("get_function", 2191 - - [](mlir::ModuleOp &self, std::string &funcName) -> mlir::FuncOp { 2192 - - return self.lookupSymbol<mlir::FuncOp>(funcName); 2193 - - }) 2194 - - .def("get_single_function", [](mlir::ModuleOp &self) -> mlir::FuncOp { 2195 - - llvm::SmallVector<mlir::FuncOp> funcs; 2196 - - self.walk([&](mlir::FuncOp func) { funcs.push_back(func); }); 2197 - - if (funcs.size() != 1) 2198 - - throw std::runtime_error("Expected a single function"); 2199 - - return funcs[0]; 2200 - - }); 2201 - + [](mlir::ModuleOp &self, 2202 - + std::string &funcName) -> mlir::func::FuncOp { 2203 - + return self.lookupSymbol<mlir::func::FuncOp>(funcName); 2204 - + }) 2205 - + .def("get_single_function", 2206 - + [](mlir::ModuleOp &self) -> mlir::func::FuncOp { 2207 - + llvm::SmallVector<mlir::func::FuncOp> funcs; 2208 - + self.walk([&](mlir::func::FuncOp func) { funcs.push_back(func); }); 2209 - + if (funcs.size() != 1) 2210 - + throw std::runtime_error("Expected a single function"); 2211 - + return funcs[0]; 2212 - + }); 2213 - 2214 - m.def("make_attr", 2215 - [](const std::vector<int> &values, mlir::MLIRContext &context) { 2216 - @@ -388,47 +391,48 @@ void init_triton_ir(py::module &&m) { 2217 - registry.insert<mlir::triton::TritonDialect, 2218 - mlir::triton::gpu::TritonGPUDialect, 2219 - mlir::math::MathDialect, mlir::arith::ArithmeticDialect, 2220 - - mlir::StandardOpsDialect, mlir::scf::SCFDialect>(); 2221 - + mlir::func::FuncDialect, mlir::scf::SCFDialect>(); 2222 - context.appendDialectRegistry(registry); 2223 - context.loadAllAvailableDialects(); 2224 - 2225 - // parse module 2226 - - mlir::OwningOpRef<mlir::ModuleOp> module( 2227 - - mlir::parseSourceFile(inputFilename, &context)); 2228 - + mlir::OwningOpRef<mlir::ModuleOp> module = 2229 - + mlir::parseSourceFile<mlir::ModuleOp>(inputFilename, &context); 2230 - + if (!module) 2231 - + throw std::runtime_error("Parse MLIR file failed."); 2232 - // locations are incompatible with ptx < 7.5 ! 2233 - module->walk([](mlir::Operation *op) { 2234 - op->setLoc(mlir::UnknownLoc::get(op->getContext())); 2235 - }); 2236 - - if (!module) 2237 - - throw std::runtime_error("Parse MLIR file failed."); 2238 - 2239 - return module->clone(); 2240 - }, 2241 - ret::take_ownership); 2242 - 2243 - - py::class_<mlir::FuncOp, mlir::OpState>(m, "function") 2244 - + py::class_<mlir::func::FuncOp, mlir::OpState>(m, "function") 2245 - // .def_property_readonly("attrs", &ir::function::attrs) 2246 - // .def("add_attr", &ir::function::add_attr); 2247 - .def("args", 2248 - - [](mlir::FuncOp &self, unsigned idx) -> mlir::BlockArgument { 2249 - + [](mlir::func::FuncOp &self, unsigned idx) -> mlir::BlockArgument { 2250 - return self.getArgument(idx); 2251 - }) 2252 - .def( 2253 - "add_entry_block", 2254 - - [](mlir::FuncOp &self) -> mlir::Block * { 2255 - + [](mlir::func::FuncOp &self) -> mlir::Block * { 2256 - return self.addEntryBlock(); 2257 - }, 2258 - ret::reference) 2259 - .def( 2260 - "set_arg_attr", 2261 - - [](mlir::FuncOp &self, int arg_no, const std::string &name, int val) { 2262 - + [](mlir::func::FuncOp &self, int arg_no, const std::string &name, 2263 - + int val) { 2264 - // set arg attributes "name" to value "val" 2265 - auto attrTy = mlir::IntegerType::get(self.getContext(), 32); 2266 - self.setArgAttr(arg_no, name, mlir::IntegerAttr::get(attrTy, val)); 2267 - }, 2268 - ret::reference) 2269 - - .def_property_readonly("type", &mlir::FuncOp::getType) 2270 - - .def("reset_type", &mlir::FuncOp::setType); 2271 - + .def_property_readonly("type", &mlir::func::FuncOp::getFunctionType) 2272 - + .def("reset_type", &mlir::func::FuncOp::setType); 2273 - 2274 - py::class_<mlir::OpBuilder::InsertPoint>(m, "InsertPoint"); 2275 - 2276 - @@ -445,13 +449,13 @@ void init_triton_ir(py::module &&m) { 2277 - .def("ret", 2278 - [](mlir::OpBuilder &self, std::vector<mlir::Value> &vals) -> void { 2279 - auto loc = self.getUnknownLoc(); 2280 - - self.create<mlir::ReturnOp>(loc, vals); 2281 - + self.create<mlir::func::ReturnOp>(loc, vals); 2282 - }) 2283 - .def("call", 2284 - - [](mlir::OpBuilder &self, mlir::FuncOp &func, 2285 - + [](mlir::OpBuilder &self, mlir::func::FuncOp &func, 2286 - std::vector<mlir::Value> &args) -> mlir::OpState { 2287 - auto loc = self.getUnknownLoc(); 2288 - - return self.create<mlir::CallOp>(loc, func, args); 2289 - + return self.create<mlir::func::CallOp>(loc, func, args); 2290 - }) 2291 - // insertion block/point 2292 - .def("set_insertion_point_to_start", 2293 - @@ -618,15 +622,16 @@ void init_triton_ir(py::module &&m) { 2294 - .def("get_or_insert_function", 2295 - [](mlir::OpBuilder &self, mlir::ModuleOp &module, 2296 - std::string &funcName, mlir::Type &funcType, 2297 - - std::string &visibility) -> mlir::FuncOp { 2298 - + std::string &visibility) -> mlir::func::FuncOp { 2299 - if (mlir::Operation *funcOperation = module.lookupSymbol(funcName)) 2300 - - return llvm::dyn_cast<mlir::FuncOp>(funcOperation); 2301 - + return llvm::dyn_cast<mlir::func::FuncOp>(funcOperation); 2302 - auto loc = self.getUnknownLoc(); 2303 - if (auto funcTy = funcType.dyn_cast<mlir::FunctionType>()) { 2304 - llvm::SmallVector<mlir::NamedAttribute> attrs = { 2305 - mlir::NamedAttribute(self.getStringAttr("sym_visibility"), 2306 - self.getStringAttr(visibility))}; 2307 - - return self.create<mlir::FuncOp>(loc, funcName, funcTy, attrs); 2308 - + return self.create<mlir::func::FuncOp>(loc, funcName, funcTy, 2309 - + attrs); 2310 - } 2311 - throw std::runtime_error("invalid function type"); 2312 - }) 2313 - @@ -658,15 +663,15 @@ void init_triton_ir(py::module &&m) { 2314 - [](mlir::OpBuilder &self, mlir::Value condition, 2315 - mlir::Block *trueDest, mlir::Block *falseDest) { 2316 - auto loc = self.getUnknownLoc(); 2317 - - self.create<mlir::CondBranchOp>(loc, condition, trueDest, 2318 - - falseDest); 2319 - + self.create<mlir::cf::CondBranchOp>(loc, condition, trueDest, 2320 - + falseDest); 2321 - return; 2322 - }) 2323 - .def("create_branch", 2324 - [](mlir::OpBuilder &self, mlir::Block *dest, 2325 - std::vector<mlir::Value> &args) { 2326 - auto loc = self.getUnknownLoc(); 2327 - - self.create<mlir::BranchOp>(loc, dest, args); 2328 - + self.create<mlir::cf::BranchOp>(loc, dest, args); 2329 - return; 2330 - }) 2331 - // Structured control flow 2332 - @@ -792,14 +797,14 @@ void init_triton_ir(py::module &&m) { 2333 - .def("create_to_index", 2334 - [](mlir::OpBuilder &self, mlir::Value &input) -> mlir::Value { 2335 - auto loc = self.getUnknownLoc(); 2336 - - return self.create<mlir::arith::IndexCastOp>(loc, input, 2337 - - self.getIndexType()); 2338 - + return self.create<mlir::arith::IndexCastOp>( 2339 - + loc, self.getIndexType(), input); 2340 - }) 2341 - .def("create_index_to_si", 2342 - [](mlir::OpBuilder &self, mlir::Value &input) -> mlir::Value { 2343 - auto loc = self.getUnknownLoc(); 2344 - - return self.create<mlir::arith::IndexCastOp>(loc, input, 2345 - - self.getI32Type()); 2346 - + return self.create<mlir::arith::IndexCastOp>( 2347 - + loc, self.getI32Type(), input); 2348 - }) 2349 - .def("create_fmul", 2350 - [](mlir::OpBuilder &self, mlir::Value &lhs, 2351 - @@ -1316,8 +1321,8 @@ void init_triton_ir(py::module &&m) { 2352 - [](mlir::OpBuilder &self, mlir::Value &condition, 2353 - mlir::Value &trueValue, mlir::Value &falseValue) -> mlir::Value { 2354 - auto loc = self.getUnknownLoc(); 2355 - - return self.create<mlir::SelectOp>(loc, condition, trueValue, 2356 - - falseValue); 2357 - + return self.create<mlir::arith::SelectOp>(loc, condition, 2358 - + trueValue, falseValue); 2359 - }) 2360 - .def("create_printf", 2361 - [](mlir::OpBuilder &self, const std::string &prefix, 2362 - @@ -1429,7 +1434,7 @@ void init_triton_ir(py::module &&m) { 2363 - self.addPass(mlir::triton::createConvertTritonGPUToLLVMPass()); 2364 - }) 2365 - .def("add_scf_to_cfg", [](mlir::PassManager &self) { 2366 - - self.addPass(mlir::createLowerToCFGPass()); 2367 - + self.addPass(mlir::createConvertSCFToCFPass()); 2368 - }); 2369 - } 2370 - 2371 - diff --git a/python/test/unit/language/test_core.py b/python/test/unit/language/test_core.py 2372 - index 432544a8a4..018f544714 100644 2373 - --- a/python/test/unit/language/test_core.py 2374 - +++ b/python/test/unit/language/test_core.py 2375 - @@ -1918,7 +1918,7 @@ def test_convert2d(dtype, shape, src_layout, dst_layout, device='cuda'): 2376 - #dst = {dst_layout} 2377 - """ + """ 2378 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 2379 - - func public @kernel_0d1d(%arg0: !tt.ptr<f16> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f16> {tt.divisibility = 16 : i32}) { 2380 - + func.func public @kernel_0d1d(%arg0: !tt.ptr<f16> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f16> {tt.divisibility = 16 : i32}) { 2381 - %cst = arith.constant dense<128> : tensor<128x1xi32, #src> 2382 - %0 = tt.make_range {end = 128 : i32, start = 0 : i32} : tensor<128xi32, #triton_gpu.slice<{dim = 1, parent = #src}>> 2383 - %1 = tt.make_range {end = 128 : i32, start = 0 : i32} : tensor<128xi32, #triton_gpu.slice<{dim = 0, parent = #src}>> 2384 - diff --git a/python/triton/compiler.py b/python/triton/compiler.py 2385 - index 5d167634df..c36589037c 100644 2386 - --- a/python/triton/compiler.py 2387 - +++ b/python/triton/compiler.py 2388 - @@ -1514,14 +1514,14 @@ def make_hash(fn, **kwargs): 2389 - return hashlib.md5((Path(fn).read_text() + triton.runtime.jit.version_key()).encode("utf-8")).hexdigest() 2390 - 2391 - 2392 - -# - ^\s*func\s+ : match the start of the string, any leading whitespace, the keyword func, 2393 - +# - ^\s*func\.func\s+ : match the start of the string, any leading whitespace, the keyword func, 2394 - # and any following whitespace 2395 - # - (public\s+)? : optionally match the keyword public and any following whitespace 2396 - # - (@\w+) : match an @ symbol followed by one or more word characters 2397 - # (letters, digits, or underscores), and capture it as group 1 (the function name) 2398 - # - (\((?:%\w+: \S+(?: \{\S+ = \S+ : \S+\})?(?:, )?)*\)) : match a pair of parentheses enclosing 2399 - # zero or more arguments separated by commas, and capture it as group 2 (the argument list) 2400 - -mlir_prototype_pattern = r'^\s*func\s+(?:public\s+)?(@\w+)(\((?:%\w+: \S+(?: \{\S+ = \S+ : \S+\})?(?:, )?)*\))\s*\{\s*$' 2401 - +mlir_prototype_pattern = r'^\s*func\.func\s+(?:public\s+)?(@\w+)(\((?:%\w+: \S+(?: \{\S+ = \S+ : \S+\})?(?:, )?)*\))\s*\{\s*$' 2402 - ptx_prototype_pattern = r"\.(?:visible|extern)\s+\.(?:entry|func)\s+(\w+)\s*\(([^)]*)\)" 2403 - prototype_pattern = { 2404 - "ttir": mlir_prototype_pattern, 2405 - diff --git a/test/Analysis/test-alias.mlir b/test/Analysis/test-alias.mlir 2406 - index b3d5673f85..bb21615e68 100644 2407 - --- a/test/Analysis/test-alias.mlir 2408 - +++ b/test/Analysis/test-alias.mlir 2409 - @@ -11,7 +11,7 @@ 2410 - 2411 - // CHECK-LABEL: matmul_loop 2412 - // There shouldn't be any aliasing with the dot op encoding. 2413 - -func @matmul_loop(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>) { 2414 - +func.func @matmul_loop(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>) { 2415 - %a_ptr_init = tt.broadcast %A : (!tt.ptr<f16>) -> tensor<128x32x!tt.ptr<f16>, #AL> 2416 - %b_ptr_init = tt.broadcast %B : (!tt.ptr<f16>) -> tensor<32x128x!tt.ptr<f16>, #BL> 2417 - %a_mask = arith.constant dense<true> : tensor<128x32xi1, #AL> 2418 - @@ -36,7 +36,7 @@ func @matmul_loop(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B 2419 - } 2420 - 2421 - // CHECK-LABEL: alloc 2422 - -func @alloc(%A : !tt.ptr<f16>) { 2423 - +func.func @alloc(%A : !tt.ptr<f16>) { 2424 - // CHECK: %cst -> %cst 2425 - %cst0 = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #A_SHARED> 2426 - %cst1 = arith.constant dense<0.000000e+00> : tensor<16x32xf16, #AL> 2427 - @@ -46,7 +46,7 @@ func @alloc(%A : !tt.ptr<f16>) { 2428 - } 2429 - 2430 - // CHECK-LABEL: convert 2431 - -func @convert(%A : !tt.ptr<f16>) { 2432 - +func.func @convert(%A : !tt.ptr<f16>) { 2433 - %cst0 = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #AL> 2434 - // CHECK: %0 -> %0 2435 - %cst1 = triton_gpu.convert_layout %cst0 : (tensor<16x16xf16, #AL>) -> tensor<16x16xf16, #A_SHARED> 2436 - @@ -54,7 +54,7 @@ func @convert(%A : !tt.ptr<f16>) { 2437 - } 2438 - 2439 - // CHECK-LABEL: trans 2440 - -func @trans(%A : !tt.ptr<f16>) { 2441 - +func.func @trans(%A : !tt.ptr<f16>) { 2442 - // CHECK: %cst -> %cst 2443 - %tensor = arith.constant dense<0.000000e+00> : tensor<16x32xf16, #A_SHARED> 2444 - // CHECK: %0 -> %cst 2445 - @@ -63,7 +63,7 @@ func @trans(%A : !tt.ptr<f16>) { 2446 - } 2447 - 2448 - // CHECK-LABEL: insert_slice_async 2449 - -func @insert_slice_async(%A : !tt.ptr<f16>, %i1 : i1) { 2450 - +func.func @insert_slice_async(%A : !tt.ptr<f16>, %i1 : i1) { 2451 - %a_ptr = tt.broadcast %A : (!tt.ptr<f16>) -> tensor<16x16x!tt.ptr<f16>, #AL> 2452 - %mask = tt.splat %i1 : (i1) -> tensor<16x16xi1, #AL> 2453 - %other = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #AL> 2454 - @@ -76,7 +76,7 @@ func @insert_slice_async(%A : !tt.ptr<f16>, %i1 : i1) { 2455 - } 2456 - 2457 - // CHECK-LABEL: insert_slice 2458 - -func @insert_slice(%A : !tt.ptr<f16>, %i1 : i1) { 2459 - +func.func @insert_slice(%A : !tt.ptr<f16>, %i1 : i1) { 2460 - %a_ptr = tt.broadcast %A : (!tt.ptr<f16>) -> tensor<16x16x!tt.ptr<f16>, #AL> 2461 - %mask = tt.splat %i1 : (i1) -> tensor<16x16xi1, #AL> 2462 - %other = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #AL> 2463 - @@ -90,7 +90,7 @@ func @insert_slice(%A : !tt.ptr<f16>, %i1 : i1) { 2464 - } 2465 - 2466 - // CHECK-LABEL: extract_slice 2467 - -func @extract_slice(%A : !tt.ptr<f16>) { 2468 - +func.func @extract_slice(%A : !tt.ptr<f16>) { 2469 - // CHECK: %cst -> %cst 2470 - %cst0 = arith.constant dense<0.000000e+00> : tensor<1x16x16xf16, #A_SHARED> 2471 - %index = arith.constant 0 : index 2472 - @@ -100,7 +100,7 @@ func @extract_slice(%A : !tt.ptr<f16>) { 2473 - } 2474 - 2475 - // CHECK-LABEL: if_cat 2476 - -func @if_cat(%i1 : i1) { 2477 - +func.func @if_cat(%i1 : i1) { 2478 - // CHECK: %cst -> %cst 2479 - %cst0 = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #A_SHARED> 2480 - // CHECK: %cst_0 -> %cst_0 2481 - @@ -119,7 +119,7 @@ func @if_cat(%i1 : i1) { 2482 - } 2483 - 2484 - // CHECK-LABEL: if_alias 2485 - -func @if_alias(%i1 : i1) { 2486 - +func.func @if_alias(%i1 : i1) { 2487 - // CHECK: %cst -> %cst 2488 - %cst0 = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #A_SHARED> 2489 - // CHECK-NEXT: %cst_0 -> %cst_0 2490 - @@ -134,7 +134,7 @@ func @if_alias(%i1 : i1) { 2491 - } 2492 - 2493 - // CHECK-LABEL: for 2494 - -func @for(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>) { 2495 - +func.func @for(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>) { 2496 - // CHECK: %cst -> %cst 2497 - %a_shared_init = arith.constant dense<0.00e+00> : tensor<128x32xf16, #A_SHARED> 2498 - // CHECK-NEXT: %cst_0 -> %cst_0 2499 - @@ -154,7 +154,7 @@ func @for(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.p 2500 - } 2501 - 2502 - // CHECK-LABEL: for_if 2503 - -func @for_if(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>, %i1 : i1) { 2504 - +func.func @for_if(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>, %i1 : i1) { 2505 - // CHECK: %cst -> %cst 2506 - %a_shared_init = arith.constant dense<0.00e+00> : tensor<128x32xf16, #A_SHARED> 2507 - // CHECK-NEXT: %cst_0 -> %cst_0 2508 - @@ -180,7 +180,7 @@ func @for_if(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !t 2509 - } 2510 - 2511 - // CHECK-LABEL: for_if_for 2512 - -func @for_if_for(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>, %i1 : i1) { 2513 - +func.func @for_if_for(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>, %i1 : i1) { 2514 - // CHECK: %cst -> %cst 2515 - %a_shared_init = arith.constant dense<0.00e+00> : tensor<128x32xf16, #A_SHARED> 2516 - // CHECK-NEXT: %cst_0 -> %cst_0 2517 - diff --git a/test/Analysis/test-alignment.mlir b/test/Analysis/test-alignment.mlir 2518 - index 0ab34c7a78..af8ea6f856 100644 2519 - --- a/test/Analysis/test-alignment.mlir 2520 - +++ b/test/Analysis/test-alignment.mlir 2521 - @@ -1,288 +1,288 @@ 2522 - -// RUN: triton-opt %s -test-print-alignment -split-input-file 2>&1 | FileCheck %s 2523 - +// RUN: triton-opt %s -test-print-alignment -split-input-file -o %t 2>&1 | FileCheck %s 2524 - 2525 - -// CHECK-LABEL: cast 2526 - -func @cast() { 2527 - - // CHECK: Contiguity: [1] ; Divisibility: [1] ; Constancy: [1] ; ConstantValue: [1] 2528 - +// CHECK-LABEL: @cast 2529 - +func.func @cast() { 2530 - + // CHECK: contiguity = [1], divisibility = [1], constancy = [1], constant_value = 1 2531 - %cst = arith.constant 1 : i32 2532 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [1] ; ConstantValue: [1] 2533 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [1], constant_value = 1 2534 - %0 = arith.extsi %cst : i32 to i64 2535 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [128] ; ConstantValue: [1] 2536 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [128], constant_value = 1 2537 - %cst_tensor = arith.constant dense<1> : tensor<128xi32> 2538 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [128] ; ConstantValue: [1] 2539 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [128], constant_value = 1 2540 - %1 = tt.bitcast %cst_tensor : tensor<128xi32> -> tensor<128xi64> 2541 - return 2542 - } 2543 - 2544 - // ----- 2545 - 2546 - -// CHECK-LABEL: add 2547 - -func @add() { 2548 - - // CHECK: Contiguity: [128] ; Divisibility: [1073741824] ; Constancy: [1] ; ConstantValue: [None] 2549 - +// CHECK-LABEL: @add 2550 - +func.func @add() { 2551 - + // CHECK: contiguity = [128], divisibility = [1073741824], constancy = [1], constant_value = <none> 2552 - %0 = tt.make_range {end = 128 : i32, start = 0 : i32} : tensor<128xi32> 2553 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [128] ; ConstantValue: [1] 2554 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [128], constant_value = 1 2555 - %1 = arith.constant dense<1> : tensor<128xi32> 2556 - - // CHECK-NEXT: Contiguity: [128] ; Divisibility: [1] ; Constancy: [1] ; ConstantValue: [None] 2557 - + // CHECK-NEXT: contiguity = [128], divisibility = [1], constancy = [1], constant_value = <none> 2558 - %2 = arith.addi %0, %1 : tensor<128xi32> 2559 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [128] ; ConstantValue: [127] 2560 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [128], constant_value = 127 2561 - %3 = arith.constant dense<127> : tensor<128xi32> 2562 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [128] ; Constancy: [128] ; ConstantValue: [128] 2563 - + // CHECK-NEXT: contiguity = [1], divisibility = [128], constancy = [128], constant_value = 128 2564 - %4 = arith.addi %1, %3 : tensor<128xi32> 2565 - return 2566 - } 2567 - 2568 - // ----- 2569 - 2570 - -// CHECK-LABEL: sub 2571 - -func @sub() { 2572 - - // CHECK: Contiguity: [128] ; Divisibility: [1073741824] ; Constancy: [1] ; ConstantValue: [None] 2573 - +// CHECK-LABEL: @sub 2574 - +func.func @sub() { 2575 - + // CHECK: contiguity = [128], divisibility = [1073741824], constancy = [1], constant_value = <none> 2576 - %0 = tt.make_range {end = 128 : i32, start = 0 : i32} : tensor<128xi32> 2577 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [128] ; ConstantValue: [1] 2578 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [128], constant_value = 1 2579 - %1 = arith.constant dense<1> : tensor<128xi32> 2580 - - // CHECK-NEXT: Contiguity: [128] ; Divisibility: [1] ; Constancy: [1] ; ConstantValue: [None] 2581 - + // CHECK-NEXT: contiguity = [128], divisibility = [1], constancy = [1], constant_value = <none> 2582 - %2 = arith.subi %0, %1 : tensor<128xi32> 2583 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [128] ; ConstantValue: [129] 2584 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [128], constant_value = 129 2585 - %3 = arith.constant dense<129> : tensor<128xi32> 2586 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [128] ; Constancy: [128] ; ConstantValue: [128] 2587 - + // CHECK-NEXT: contiguity = [1], divisibility = [128], constancy = [128], constant_value = 128 2588 - %4 = arith.subi %3, %1 : tensor<128xi32> 2589 - return 2590 - } 2591 - 2592 - // ----- 2593 - 2594 - -// CHECK-LABEL: mul 2595 - -func @mul() { 2596 - - // CHECK: Contiguity: [128] ; Divisibility: [1073741824] ; Constancy: [1] ; ConstantValue: [None] 2597 - +// CHECK-LABEL: @mul 2598 - +func.func @mul() { 2599 - + // CHECK: contiguity = [128], divisibility = [1073741824], constancy = [1], constant_value = <none> 2600 - %0 = tt.make_range {end = 128 : i32, start = 0 : i32} : tensor<128xi32> 2601 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [128] ; ConstantValue: [1] 2602 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [128], constant_value = 1 2603 - %1 = arith.constant dense<1> : tensor<128xi32> 2604 - - // CHECK-NEXT: Contiguity: [128] ; Divisibility: [1073741824] ; Constancy: [1] ; ConstantValue: [None] 2605 - + // CHECK-NEXT: contiguity = [128], divisibility = [1073741824], constancy = [1], constant_value = <none> 2606 - %2 = arith.muli %0, %1 : tensor<128xi32> 2607 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [128] ; Constancy: [128] ; ConstantValue: [128] 2608 - + // CHECK-NEXT: contiguity = [1], divisibility = [128], constancy = [128], constant_value = 128 2609 - %3 = arith.constant dense<128> : tensor<128xi32> 2610 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [128] ; Constancy: [128] ; ConstantValue: [128] 2611 - + // CHECK-NEXT: contiguity = [1], divisibility = [128], constancy = [128], constant_value = 128 2612 - %4 = arith.muli %3, %1 : tensor<128xi32> 2613 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [2] ; Constancy: [128] ; ConstantValue: [2] 2614 - + // CHECK-NEXT: contiguity = [1], divisibility = [2], constancy = [128], constant_value = 2 2615 - %5 = arith.constant dense<2> : tensor<128xi32> 2616 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [256] ; Constancy: [128] ; ConstantValue: [256] 2617 - + // CHECK-NEXT: contiguity = [1], divisibility = [256], constancy = [128], constant_value = 256 2618 - %6 = arith.muli %4, %5 : tensor<128xi32> 2619 - return 2620 - } 2621 - 2622 - // ----- 2623 - 2624 - -// CHECK-LABEL: div 2625 - -func @div() { 2626 - - // CHECK: Contiguity: [128] ; Divisibility: [1073741824] ; Constancy: [1] ; ConstantValue: [None] 2627 - +// CHECK-LABEL: @div 2628 - +func.func @div() { 2629 - + // CHECK: contiguity = [128], divisibility = [1073741824], constancy = [1], constant_value = <none> 2630 - %0 = tt.make_range {end = 128 : i32, start = 0 : i32} : tensor<128xi32> 2631 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [128] ; ConstantValue: [1] 2632 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [128], constant_value = 1 2633 - %1 = arith.constant dense<1> : tensor<128xi32> 2634 - - // CHECK-NEXT: Contiguity: [128] ; Divisibility: [1073741824] ; Constancy: [1] ; ConstantValue: [None] 2635 - + // CHECK-NEXT: contiguity = [128], divisibility = [1073741824], constancy = [1], constant_value = <none> 2636 - %2 = arith.divsi %0, %1 : tensor<128xi32> 2637 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [1] ; ConstantValue: [None] 2638 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [1], constant_value = <none> 2639 - %3 = arith.divui %1, %0 : tensor<128xi32> 2640 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [64] ; Constancy: [128] ; ConstantValue: [64] 2641 - + // CHECK-NEXT: contiguity = [1], divisibility = [64], constancy = [128], constant_value = 64 2642 - %4 = arith.constant dense<64> : tensor<128xi32> 2643 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [16777216] ; Constancy: [64] ; ConstantValue: [None] 2644 - + // CHECK-NEXT: contiguity = [1], divisibility = [16777216], constancy = [64], constant_value = <none> 2645 - %5 = arith.divsi %0, %4 : tensor<128xi32> 2646 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [1] ; ConstantValue: [None] 2647 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [1], constant_value = <none> 2648 - %6 = arith.divsi %4, %0 : tensor<128xi32> 2649 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [64] ; Constancy: [128] ; ConstantValue: [64] 2650 - + // CHECK-NEXT: contiguity = [1], divisibility = [64], constancy = [128], constant_value = 64 2651 - %7 = arith.divsi %4, %1 : tensor<128xi32> 2652 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [2] ; Constancy: [128] ; ConstantValue: [66] 2653 - + // CHECK-NEXT: contiguity = [1], divisibility = [2], constancy = [128], constant_value = 66 2654 - %8 = arith.constant dense<66> : tensor<128xi32> 2655 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [2] ; ConstantValue: [None] 2656 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [2], constant_value = <none> 2657 - %9 = arith.divui %0, %8 : tensor<128xi32> 2658 - - // CHECK-NEXT: Contiguity: [128] ; Divisibility: [8192] ; Constancy: [1] ; ConstantValue: [None] 2659 - + // CHECK-NEXT: contiguity = [128], divisibility = [8192], constancy = [1], constant_value = <none> 2660 - %10 = tt.make_range {end = 8320 : i32, start = 8192 : i32} : tensor<128xi32> 2661 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [128] ; Constancy: [64] ; ConstantValue: [None] 2662 - + // CHECK-NEXT: contiguity = [1], divisibility = [128], constancy = [64], constant_value = <none> 2663 - %11 = arith.divsi %10, %4 : tensor<128xi32> 2664 - - return 2665 - + return 2666 - } 2667 - 2668 - // ----- 2669 - 2670 - -// CHECK-LABEL: rem 2671 - -func @rem() { 2672 - - // CHECK: Contiguity: [128] ; Divisibility: [1073741824] ; Constancy: [1] ; ConstantValue: [None] 2673 - +// CHECK-LABEL: @rem 2674 - +func.func @rem() { 2675 - + // CHECK: contiguity = [128], divisibility = [1073741824], constancy = [1], constant_value = <none> 2676 - %0 = tt.make_range {end = 128 : i32, start = 0 : i32} : tensor<128xi32> 2677 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [128] ; ConstantValue: [1] 2678 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [128], constant_value = 1 2679 - %1 = arith.constant dense<1> : tensor<128xi32> 2680 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [4611686018427387904] ; Constancy: [128] ; ConstantValue: [0] 2681 - + // CHECK-NEXT: contiguity = [1], divisibility = [4611686018427387904], constancy = [128], constant_value = 0 2682 - %2 = arith.remsi %0, %1 : tensor<128xi32> 2683 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [1] ; ConstantValue: [None] 2684 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [1], constant_value = <none> 2685 - %3 = arith.remui %1, %0 : tensor<128xi32> 2686 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [64] ; Constancy: [128] ; ConstantValue: [64] 2687 - + // CHECK-NEXT: contiguity = [1], divisibility = [64], constancy = [128], constant_value = 64 2688 - %4 = arith.constant dense<64> : tensor<128xi32> 2689 - - // CHECK-NEXT: Contiguity: [64] ; Divisibility: [64] ; Constancy: [1] ; ConstantValue: [None] 2690 - + // CHECK-NEXT: contiguity = [64], divisibility = [64], constancy = [1], constant_value = <none> 2691 - %5 = arith.remsi %0, %4 : tensor<128xi32> 2692 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [64] ; Constancy: [1] ; ConstantValue: [None] 2693 - + // CHECK-NEXT: contiguity = [1], divisibility = [64], constancy = [1], constant_value = <none> 2694 - %6 = arith.remsi %4, %0 : tensor<128xi32> 2695 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [2] ; Constancy: [128] ; ConstantValue: [66] 2696 - + // CHECK-NEXT: contiguity = [1], divisibility = [2], constancy = [128], constant_value = 66 2697 - %7 = arith.constant dense<66> : tensor<128xi32> 2698 - - // CHECK-NEXT: Contiguity: [2] ; Divisibility: [2] ; Constancy: [1] ; ConstantValue: [None] 2699 - + // CHECK-NEXT: contiguity = [2], divisibility = [2], constancy = [1], constant_value = <none> 2700 - %8 = arith.remui %0, %7 : tensor<128xi32> 2701 - - return 2702 - + return 2703 - } 2704 - 2705 - // ----- 2706 - 2707 - -// CHECK-LABEL: broadcast 2708 - -func @broadcast() { 2709 - - // CHECK: Contiguity: [1] ; Divisibility: [64] ; Constancy: [128] ; ConstantValue: [64] 2710 - +// CHECK-LABEL: @broadcast 2711 - +func.func @broadcast() { 2712 - + // CHECK: contiguity = [1], divisibility = [64], constancy = [128], constant_value = 64 2713 - %0 = arith.constant dense<64> : tensor<128xi32> 2714 - - // CHECK-NEXT: Contiguity: [1, 1] ; Divisibility: [64, 1] ; Constancy: [128, 1] ; ConstantValue: [64] 2715 - + // CHECK-NEXT: contiguity = [1, 1], divisibility = [64, 1], constancy = [128, 1], constant_value = 64 2716 - %1 = tt.expand_dims %0 {axis = 1 : i32} : (tensor<128xi32>) -> tensor<128x1xi32> 2717 - - // CHECK-NEXT: Contiguity: [1, 1] ; Divisibility: [64, 1] ; Constancy: [128, 128] ; ConstantValue: [64] 2718 - + // CHECK-NEXT: contiguity = [1, 1], divisibility = [64, 1], constancy = [128, 128], constant_value = 64 2719 - %2 = tt.broadcast %1 : (tensor<128x1xi32>) -> tensor<128x128xi32> 2720 - return 2721 - } 2722 - 2723 - // ----- 2724 - 2725 - -// CHECK-LABEL: splat 2726 - -func @splat(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}) { 2727 - - // CHECK: Contiguity: [1, 1] ; Divisibility: [16, 16] ; Constancy: [128, 128] ; ConstantValue: [None] 2728 - +// CHECK-LABEL: @splat 2729 - +func.func @splat(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}) { 2730 - + // CHECK: contiguity = [1, 1], divisibility = [16, 16], constancy = [128, 128], constant_value = <none> 2731 - %0 = tt.splat %arg0 : (!tt.ptr<f32>) -> tensor<128x128x!tt.ptr<f32>> 2732 - return 2733 - } 2734 - 2735 - // ----- 2736 - 2737 - -// CHECK-LABEL: cmp 2738 - -func @cmp() { 2739 - - // CHECK: Contiguity: [128] ; Divisibility: [1073741824] ; Constancy: [1] ; ConstantValue: [None] 2740 - +// CHECK-LABEL: @cmp 2741 - +func.func @cmp() { 2742 - + // CHECK: contiguity = [128], divisibility = [1073741824], constancy = [1], constant_value = <none> 2743 - %0 = tt.make_range {end = 128 : i32, start = 0 : i32} : tensor<128xi32> 2744 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [4611686018427387904] ; Constancy: [128] ; ConstantValue: [0] 2745 - + // CHECK-NEXT: contiguity = [1], divisibility = [4611686018427387904], constancy = [128], constant_value = 0 2746 - %1 = arith.constant dense<0> : tensor<128xi32> 2747 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [128] ; ConstantValue: [None] 2748 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [128], constant_value = <none> 2749 - %2 = arith.cmpi eq, %0, %1 : tensor<128xi32> 2750 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [128] ; ConstantValue: [None] 2751 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [128], constant_value = <none> 2752 - %3 = arith.cmpi slt, %0, %1 : tensor<128xi32> 2753 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [1] ; ConstantValue: [None] 2754 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [1], constant_value = <none> 2755 - %4 = arith.cmpi sle, %0, %1 : tensor<128xi32> 2756 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [128] ; ConstantValue: [None] 2757 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [128], constant_value = <none> 2758 - %5 = arith.cmpi sge, %0, %1 : tensor<128xi32> 2759 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [8] ; Constancy: [128] ; ConstantValue: [8] 2760 - + // CHECK-NEXT: contiguity = [1], divisibility = [8], constancy = [128], constant_value = 8 2761 - %6 = arith.constant dense<8> : tensor<128xi32> 2762 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [8] ; ConstantValue: [None] 2763 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [8], constant_value = <none> 2764 - %7 = arith.cmpi sgt, %0, %6 : tensor<128xi32> 2765 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [128] ; ConstantValue: [0] 2766 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [128], constant_value = 0 2767 - %8 = arith.cmpi sgt, %1, %6 : tensor<128xi32> 2768 - return 2769 - } 2770 - 2771 - // ----- 2772 - 2773 - -// CHECK-LABEL: logic 2774 - -func @logic() { 2775 - - // CHECK: Contiguity: [128] ; Divisibility: [1073741824] ; Constancy: [1] ; ConstantValue: [None] 2776 - +// CHECK-LABEL: @logic 2777 - +func.func @logic() { 2778 - + // CHECK: contiguity = [128], divisibility = [1073741824], constancy = [1], constant_value = <none> 2779 - %0 = tt.make_range {end = 128 : i32, start = 0 : i32} : tensor<128xi32> 2780 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [64] ; Constancy: [128] ; ConstantValue: [64] 2781 - + // CHECK-NEXT: contiguity = [1], divisibility = [64], constancy = [128], constant_value = 64 2782 - %1 = arith.constant dense<64> : tensor<128xi32> 2783 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [16777216] ; Constancy: [64] ; ConstantValue: [None] 2784 - + // CHECK-NEXT: contiguity = [1], divisibility = [16777216], constancy = [64], constant_value = <none> 2785 - %2 = arith.divsi %0, %1 : tensor<128xi32> 2786 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [8] ; Constancy: [128] ; ConstantValue: [8] 2787 - + // CHECK-NEXT: contiguity = [1], divisibility = [8], constancy = [128], constant_value = 8 2788 - %3 = arith.constant dense<8> : tensor<128xi32> 2789 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [134217728] ; Constancy: [8] ; ConstantValue: [None] 2790 - + // CHECK-NEXT: contiguity = [1], divisibility = [134217728], constancy = [8], constant_value = <none> 2791 - %4 = arith.divsi %0, %3 : tensor<128xi32> 2792 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [1] ; ConstantValue: [None] 2793 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [1], constant_value = <none> 2794 - %5 = arith.andi %0, %1 : tensor<128xi32> 2795 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [1] ; ConstantValue: [None] 2796 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [1], constant_value = <none> 2797 - %6 = arith.ori %0, %1 : tensor<128xi32> 2798 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [1] ; ConstantValue: [None] 2799 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [1], constant_value = <none> 2800 - %7 = arith.xori %0, %1 : tensor<128xi32> 2801 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [8] ; ConstantValue: [None] 2802 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [8], constant_value = <none> 2803 - %8 = arith.andi %2, %4 : tensor<128xi32> 2804 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [8] ; ConstantValue: [None] 2805 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [8], constant_value = <none> 2806 - %9 = arith.ori %2, %4 : tensor<128xi32> 2807 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [8] ; ConstantValue: [None] 2808 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [8], constant_value = <none> 2809 - %10 = arith.xori %2, %4 : tensor<128xi32> 2810 - return 2811 - } 2812 - 2813 - // ----- 2814 - 2815 - -// CHECK-LABEL: select 2816 - -func @select() { 2817 - - // CHECK: Contiguity: [128] ; Divisibility: [1073741824] ; Constancy: [1] ; ConstantValue: [None] 2818 - +// CHECK-LABEL: @select 2819 - +func.func @select() { 2820 - + // CHECK: contiguity = [128], divisibility = [1073741824], constancy = [1], constant_value = <none> 2821 - %0 = tt.make_range {end = 128 : i32, start = 0 : i32} : tensor<128xi32> 2822 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [4611686018427387904] ; Constancy: [128] ; ConstantValue: [0] 2823 - + // CHECK-NEXT: contiguity = [1], divisibility = [4611686018427387904], constancy = [128], constant_value = 0 2824 - %1 = arith.constant dense<0> : tensor<128xi32> 2825 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [128] ; ConstantValue: [None] 2826 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [128], constant_value = <none> 2827 - %2 = arith.cmpi eq, %0, %1 : tensor<128xi32> 2828 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [128] ; ConstantValue: [None] 2829 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [128], constant_value = <none> 2830 - %3 = arith.cmpi slt, %0, %1 : tensor<128xi32> 2831 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [4611686018427387904] ; Constancy: [1] ; ConstantValue: [0] 2832 - + // CHECK-NEXT: contiguity = [1], divisibility = [4611686018427387904], constancy = [1], constant_value = 0 2833 - %4 = arith.constant 0 : i1 2834 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [4611686018427387904] ; Constancy: [128] ; ConstantValue: [0] 2835 - + // CHECK-NEXT: contiguity = [1], divisibility = [4611686018427387904], constancy = [128], constant_value = 0 2836 - %7 = tt.splat %4 : (i1) -> tensor<128xi1> 2837 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [4611686018427387904] ; Constancy: [128] ; ConstantValue: [0] 2838 - - %5 = select %4, %3, %7 : tensor<128xi1> 2839 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [128] ; ConstantValue: [None] 2840 - + // CHECK-NEXT: contiguity = [1], divisibility = [4611686018427387904], constancy = [128], constant_value = 0 2841 - + %5 = arith.select %4, %3, %7 : tensor<128xi1> 2842 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [128], constant_value = <none> 2843 - %8 = "triton_gpu.select"(%7, %3, %2) : (tensor<128xi1>, tensor<128xi1>, tensor<128xi1>) -> tensor<128xi1> 2844 - return 2845 - } 2846 - 2847 - // ----- 2848 - 2849 - -func @shift() { 2850 - - // CHECK: Contiguity: [128] ; Divisibility: [1073741824] ; Constancy: [1] ; ConstantValue: [None] 2851 - +func.func @shift() { 2852 - + // CHECK: contiguity = [128], divisibility = [1073741824], constancy = [1], constant_value = <none> 2853 - %0 = tt.make_range {end = 128 : i32, start = 0 : i32} : tensor<128xi32> 2854 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [8] ; Constancy: [128] ; ConstantValue: [8] 2855 - + // CHECK-NEXT: contiguity = [1], divisibility = [8], constancy = [128], constant_value = 8 2856 - %1 = arith.constant dense<8> : tensor<128xi32> 2857 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [4] ; Constancy: [128] ; ConstantValue: [4] 2858 - + // CHECK-NEXT: contiguity = [1], divisibility = [4], constancy = [128], constant_value = 4 2859 - %2 = arith.constant dense<4> : tensor<128xi32> 2860 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [274877906944] ; Constancy: [1] ; ConstantValue: [None] 2861 - + // CHECK-NEXT: contiguity = [1], divisibility = [274877906944], constancy = [1], constant_value = <none> 2862 - %3 = arith.shli %0, %1 : tensor<128xi32> 2863 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [67108864] ; Constancy: [1] ; ConstantValue: [None] 2864 - + // CHECK-NEXT: contiguity = [1], divisibility = [67108864], constancy = [1], constant_value = <none> 2865 - %4 = arith.shrsi %0, %2 : tensor<128xi32> 2866 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [128] ; Constancy: [128] ; ConstantValue: [128] 2867 - + // CHECK-NEXT: contiguity = [1], divisibility = [128], constancy = [128], constant_value = 128 2868 - %5 = arith.shli %1, %2 : tensor<128xi32> 2869 - return 2870 - } 2871 - 2872 - // ----- 2873 - 2874 - -func @max_min() { 2875 - - // CHECK: Contiguity: [128] ; Divisibility: [1073741824] ; Constancy: [1] ; ConstantValue: [None] 2876 - +func.func @max_min() { 2877 - + // CHECK: contiguity = [128], divisibility = [1073741824], constancy = [1], constant_value = <none> 2878 - %0 = tt.make_range {end = 128 : i32, start = 0 : i32} : tensor<128xi32> 2879 - - // CHECK-NEXT: Contiguity: [128] ; Divisibility: [64] ; Constancy: [1] ; ConstantValue: [None] 2880 - + // CHECK-NEXT: contiguity = [128], divisibility = [64], constancy = [1], constant_value = <none> 2881 - %1 = tt.make_range {end = 192 : i32, start = 64 : i32} : tensor<128xi32> 2882 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [1] ; ConstantValue: [None] 2883 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [1], constant_value = <none> 2884 - %2 = arith.maxsi %0, %1 : tensor<128xi32> 2885 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [1] ; ConstantValue: [None] 2886 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [1], constant_value = <none> 2887 - %3 = arith.minsi %0, %1 : tensor<128xi32> 2888 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [8] ; Constancy: [128] ; ConstantValue: [8] 2889 - + // CHECK-NEXT: contiguity = [1], divisibility = [8], constancy = [128], constant_value = 8 2890 - %4 = arith.constant dense<8> : tensor<128xi32> 2891 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [4] ; Constancy: [128] ; ConstantValue: [4] 2892 - + // CHECK-NEXT: contiguity = [1], divisibility = [4], constancy = [128], constant_value = 4 2893 - %5 = arith.constant dense<4> : tensor<128xi32> 2894 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [1] ; ConstantValue: [8] 2895 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [1], constant_value = 8 2896 - %6 = arith.maxsi %4, %5 : tensor<128xi32> 2897 - return 2898 - } 2899 - 2900 - // ----- 2901 - 2902 - -// CHECK-LABEL: for 2903 - -func @for() { 2904 - - // CHECK: Contiguity: [1, 1] ; Divisibility: [4611686018427387904, 4611686018427387904] ; Constancy: [128, 32] ; ConstantValue: [0] 2905 - +// CHECK-LABEL: @for 2906 - +func.func @for() { 2907 - + // CHECK: contiguity = [1, 1], divisibility = [4611686018427387904, 4611686018427387904], constancy = [128, 32], constant_value = 0 2908 - %a_init = arith.constant dense<0> : tensor<128x32xi32> 2909 - - // CHECK-NEXT: Contiguity: [1, 1] ; Divisibility: [1, 1] ; Constancy: [128, 32] ; ConstantValue: [1] 2910 - + // CHECK-NEXT: contiguity = [1, 1], divisibility = [1, 1], constancy = [128, 32], constant_value = 1 2911 - %b_init = arith.constant dense<1> : tensor<128x32xi32> 2912 - - // CHECK-NEXT: Contiguity: [1, 1] ; Divisibility: [4, 4] ; Constancy: [128, 32] ; ConstantValue: [4] 2913 - + // CHECK-NEXT: contiguity = [1, 1], divisibility = [4, 4], constancy = [128, 32], constant_value = 4 2914 - %c_init = arith.constant dense<4> : tensor<128x32xi32> 2915 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [128] ; Constancy: [1] ; ConstantValue: [128] 2916 - + // CHECK-NEXT: contiguity = [1], divisibility = [128], constancy = [1], constant_value = 128 2917 - %ub = arith.constant 128 : index 2918 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [4611686018427387904] ; Constancy: [1] ; ConstantValue: [0] 2919 - + // CHECK-NEXT: contiguity = [1], divisibility = [4611686018427387904], constancy = [1], constant_value = 0 2920 - %lb = arith.constant 0 : index 2921 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [16] ; Constancy: [1] ; ConstantValue: [16] 2922 - + // CHECK-NEXT: contiguity = [1], divisibility = [16], constancy = [1], constant_value = 16 2923 - %step = arith.constant 16 : index 2924 - %a, %b, %c = scf.for %iv = %lb to %ub step %step iter_args(%a = %a_init, %b = %b_init, %c = %c_init) -> (tensor<128x32xi32>, tensor<128x32xi32>, tensor<128x32xi32>) { 2925 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [16] ; Constancy: [1] ; ConstantValue: [None] 2926 - + // CHECK-NEXT: contiguity = [1], divisibility = [16], constancy = [1], constant_value = <none> 2927 - %t = arith.index_cast %iv : index to i32 2928 - - // CHECK: Contiguity: [1, 1] ; Divisibility: [1, 1] ; Constancy: [128, 32] ; ConstantValue: [None] 2929 - - // CHECK: Contiguity: [1, 1] ; Divisibility: [1, 1] ; Constancy: [128, 32] ; ConstantValue: [None] 2930 - - // CHECK: Contiguity: [1, 1] ; Divisibility: [4, 4] ; Constancy: [128, 32] ; ConstantValue: [4] 2931 - + // CHECK: contiguity = [1, 1], divisibility = [1, 1], constancy = [128, 32], constant_value = <none> 2932 - + // CHECK: contiguity = [1, 1], divisibility = [1, 1], constancy = [128, 32], constant_value = <none> 2933 - + // CHECK: contiguity = [1, 1], divisibility = [4, 4], constancy = [128, 32], constant_value = 4 2934 - scf.yield %b, %a, %c : tensor<128x32xi32>, tensor<128x32xi32>, tensor<128x32xi32> 2935 - } 2936 - return 2937 - @@ -290,53 +290,53 @@ func @for() { 2938 - 2939 - // ----- 2940 - 2941 - -// CHECK-LABEL: permute_2d 2942 - -func @permute_2d(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg1: i32 {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg3: i32 {tt.divisibility = 16 : i32}) { 2943 - - // CHECK: Contiguity: [1, 1] ; Divisibility: [1, 1] ; Constancy: [128, 128] ; ConstantValue: [1] 2944 - +// CHECK-LABEL: @permute_2d 2945 - +func.func @permute_2d(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg1: i32 {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg3: i32 {tt.divisibility = 16 : i32}) { 2946 - + // CHECK: contiguity = [1, 1], divisibility = [1, 1], constancy = [128, 128], constant_value = 1 2947 - %cst = arith.constant dense<true> : tensor<128x128xi1> 2948 - - // CHECK-NEXT: Contiguity: [1, 1] ; Divisibility: [1, 1] ; Constancy: [1, 1] ; ConstantValue: [None] 2949 - + // CHECK-NEXT: contiguity = [1, 1], divisibility = [1, 1], constancy = [1, 1], constant_value = <none> 2950 - %cst_0 = arith.constant dense<0.000000e+00> : tensor<128x128xf32> 2951 - - // CHECK-NEXT: Contiguity: [128] ; Divisibility: [1073741824] ; Constancy: [1] ; ConstantValue: [None] 2952 - + // CHECK-NEXT: contiguity = [128], divisibility = [1073741824], constancy = [1], constant_value = <none> 2953 - %0 = tt.make_range {end = 128 : i32, start = 0 : i32} : tensor<128xi32> 2954 - - // CHECK-NEXT: Contiguity: [128] ; Divisibility: [1073741824] ; Constancy: [1] ; ConstantValue: [None] 2955 - + // CHECK-NEXT: contiguity = [128], divisibility = [1073741824], constancy = [1], constant_value = <none> 2956 - %1 = tt.make_range {end = 128 : i32, start = 0 : i32} : tensor<128xi32> 2957 - - // CHECK-NEXT: Contiguity: [128, 1] ; Divisibility: [1073741824, 1] ; Constancy: [1, 1] ; ConstantValue: [None] 2958 - + // CHECK-NEXT: contiguity = [128, 1], divisibility = [1073741824, 1], constancy = [1, 1], constant_value = <none> 2959 - %2 = tt.expand_dims %0 {axis = 1 : i32} : (tensor<128xi32>) -> tensor<128x1xi32> 2960 - - // CHECK-NEXT: Contiguity: [1, 1] ; Divisibility: [16, 16] ; Constancy: [128, 1] ; ConstantValue: [None] 2961 - + // CHECK-NEXT: contiguity = [1, 1], divisibility = [16, 16], constancy = [128, 1], constant_value = <none> 2962 - %3 = tt.splat %arg1 : (i32) -> tensor<128x1xi32> 2963 - - // CHECK-NEXT: Contiguity: [1, 1] ; Divisibility: [17179869184, 16] ; Constancy: [1, 1] ; ConstantValue: [None] 2964 - + // CHECK-NEXT: contiguity = [1, 1], divisibility = [17179869184, 16], constancy = [1, 1], constant_value = <none> 2965 - %4 = arith.muli %2, %3 : tensor<128x1xi32> 2966 - - // CHECK-NEXT: Contiguity: [1, 1] ; Divisibility: [16, 16] ; Constancy: [128, 1] ; ConstantValue: [None] 2967 - + // CHECK-NEXT: contiguity = [1, 1], divisibility = [16, 16], constancy = [128, 1], constant_value = <none> 2968 - %5 = tt.splat %arg0 : (!tt.ptr<f32>) -> tensor<128x1x!tt.ptr<f32>> 2969 - - // CHECK-NEXT: Contiguity: [1, 1] ; Divisibility: [16, 16] ; Constancy: [1, 1] ; ConstantValue: [None] 2970 - + // CHECK-NEXT: contiguity = [1, 1], divisibility = [16, 16], constancy = [1, 1], constant_value = <none> 2971 - %6 = tt.addptr %5, %4 : tensor<128x1x!tt.ptr<f32>>, tensor<128x1xi32> 2972 - - // CHECK-NEXT: Contiguity: [1, 128] ; Divisibility: [1, 1073741824] ; Constancy: [1, 1] ; ConstantValue: [None] 2973 - + // CHECK-NEXT: contiguity = [1, 128], divisibility = [1, 1073741824], constancy = [1, 1], constant_value = <none> 2974 - %7 = tt.expand_dims %1 {axis = 0 : i32}: (tensor<128xi32>) -> tensor<1x128xi32> 2975 - - // CHECK-NEXT: Contiguity: [1, 1] ; Divisibility: [16, 16] ; Constancy: [1, 128] ; ConstantValue: [None] 2976 - + // CHECK-NEXT: contiguity = [1, 1], divisibility = [16, 16], constancy = [1, 128], constant_value = <none> 2977 - %8 = tt.broadcast %6 : (tensor<128x1x!tt.ptr<f32>>) -> tensor<128x128x!tt.ptr<f32>> 2978 - - // CHECK-NEXT: Contiguity: [1, 128] ; Divisibility: [1, 1073741824] ; Constancy: [128, 1] ; ConstantValue: [None] 2979 - + // CHECK-NEXT: contiguity = [1, 128], divisibility = [1, 1073741824], constancy = [128, 1], constant_value = <none> 2980 - %9 = tt.broadcast %7 : (tensor<1x128xi32>) -> tensor<128x128xi32> 2981 - - // CHECK-NEXT: Contiguity: [1, 128] ; Divisibility: [1, 16] ; Constancy: [1, 1] ; ConstantValue: [None] 2982 - + // CHECK-NEXT: contiguity = [1, 128], divisibility = [1, 16], constancy = [1, 1], constant_value = <none> 2983 - %10 = tt.addptr %8, %9 : tensor<128x128x!tt.ptr<f32>>, tensor<128x128xi32> 2984 - - // CHECK-NEXT: Contiguity: [128, 1] ; Divisibility: [1073741824, 1] ; Constancy: [1, 1] ; ConstantValue: [None] 2985 - + // CHECK-NEXT: contiguity = [128, 1], divisibility = [1073741824, 1], constancy = [1, 1], constant_value = <none> 2986 - %11 = tt.expand_dims %0 {axis = 1 : i32}: (tensor<128xi32>) -> tensor<128x1xi32> 2987 - - // CHECK-NEXT: Contiguity: [1, 1] ; Divisibility: [16, 16] ; Constancy: [128, 1] ; ConstantValue: [None] 2988 - + // CHECK-NEXT: contiguity = [1, 1], divisibility = [16, 16], constancy = [128, 1], constant_value = <none> 2989 - %12 = tt.splat %arg2 : (!tt.ptr<f32>) -> tensor<128x1x!tt.ptr<f32>> 2990 - - // CHECK-NEXT: Contiguity: [128, 1] ; Divisibility: [16, 1] ; Constancy: [1, 1] ; ConstantValue: [None] 2991 - + // CHECK-NEXT: contiguity = [128, 1], divisibility = [16, 1], constancy = [1, 1], constant_value = <none> 2992 - %13 = tt.addptr %12, %11 : tensor<128x1x!tt.ptr<f32>>, tensor<128x1xi32> 2993 - - // CHECK-NEXT: Contiguity: [1, 128] ; Divisibility: [1, 1073741824] ; Constancy: [1, 1] ; ConstantValue: [None] 2994 - + // CHECK-NEXT: contiguity = [1, 128], divisibility = [1, 1073741824], constancy = [1, 1], constant_value = <none> 2995 - %14 = tt.expand_dims %1 {axis = 0 : i32} : (tensor<128xi32>) -> tensor<1x128xi32> 2996 - - // CHECK-NEXT: Contiguity: [1, 1] ; Divisibility: [16, 16] ; Constancy: [1, 128] ; ConstantValue: [None] 2997 - + // CHECK-NEXT: contiguity = [1, 1], divisibility = [16, 16], constancy = [1, 128], constant_value = <none> 2998 - %15 = tt.splat %arg3 : (i32) -> tensor<1x128xi32> 2999 - - // CHECK-NEXT: Contiguity: [1, 1] ; Divisibility: [16, 17179869184] ; Constancy: [1, 1] ; ConstantValue: [None] 3000 - + // CHECK-NEXT: contiguity = [1, 1], divisibility = [16, 17179869184], constancy = [1, 1], constant_value = <none> 3001 - %16 = arith.muli %14, %15 : tensor<1x128xi32> 3002 - - // CHECK-NEXT: Contiguity: [128, 1] ; Divisibility: [16, 1] ; Constancy: [1, 128] ; ConstantValue: [None] 3003 - + // CHECK-NEXT: contiguity = [128, 1], divisibility = [16, 1], constancy = [1, 128], constant_value = <none> 3004 - %17 = tt.broadcast %13 : (tensor<128x1x!tt.ptr<f32>>) -> tensor<128x128x!tt.ptr<f32>> 3005 - - // CHECK-NEXT: Contiguity: [1, 1] ; Divisibility: [16, 17179869184] ; Constancy: [128, 1] ; ConstantValue: [None] 3006 - + // CHECK-NEXT: contiguity = [1, 1], divisibility = [16, 17179869184], constancy = [128, 1], constant_value = <none> 3007 - %18 = tt.broadcast %16 : (tensor<1x128xi32>) -> tensor<128x128xi32> 3008 - - // CHECK-NEXT: Contiguity: [128, 1] ; Divisibility: [16, 1] ; Constancy: [1, 1] ; ConstantValue: [None] 3009 - + // CHECK-NEXT: contiguity = [128, 1], divisibility = [16, 1], constancy = [1, 1], constant_value = <none> 3010 - %19 = tt.addptr %17, %18 : tensor<128x128x!tt.ptr<f32>>, tensor<128x128xi32> 3011 - - // CHECK-NEXT: Contiguity: [1, 1] ; Divisibility: [1, 1] ; Constancy: [1, 1] ; ConstantValue: [None] 3012 - + // CHECK-NEXT: contiguity = [1, 1], divisibility = [1, 1], constancy = [1, 1], constant_value = <none> 3013 - %20 = tt.load %10, %cst, %cst_0 {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : tensor<128x128xf32> 3014 - tt.store %19, %20, %cst : tensor<128x128xf32> 3015 - return 3016 - @@ -347,29 +347,29 @@ func @permute_2d(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg1: i32 {t 3017 - module { 3018 - 3019 - // This is a tiny test for verifying StoreOp-related alignment, It simply store a constant to a buffer. 3020 - -// CHECK-LABEL: store_constant_align 3021 - -func @store_constant_align(%addr: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %n: i32 {tt.divisibility = 16 : i32}) { 3022 - - // CHECK: Contiguity: [1] ; Divisibility: [1] ; Constancy: [1] ; ConstantValue: [None] 3023 - +// CHECK-LABEL: @store_constant_align 3024 - +func.func @store_constant_align(%addr: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %n: i32 {tt.divisibility = 16 : i32}) { 3025 - + // CHECK: contiguity = [1], divisibility = [1], constancy = [1], constant_value = <none> 3026 - %pid = tt.get_program_id {axis = 0 : i32} : i32 3027 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [128] ; Constancy: [1] ; ConstantValue: [128] 3028 - + // CHECK-NEXT: contiguity = [1], divisibility = [128], constancy = [1], constant_value = 128 3029 - %c128_i32 = arith.constant 128 : i32 3030 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [128] ; Constancy: [1] ; ConstantValue: [None] 3031 - + // CHECK-NEXT: contiguity = [1], divisibility = [128], constancy = [1], constant_value = <none> 3032 - %1 = arith.muli %pid, %c128_i32 : i32 3033 - - // CHECK-NEXT: Contiguity: [128] ; Divisibility: [1073741824] ; Constancy: [1] ; ConstantValue: [None] 3034 - + // CHECK-NEXT: contiguity = [128], divisibility = [1073741824], constancy = [1], constant_value = <none> 3035 - %2 = tt.make_range {end = 128 : i32, start = 0 : i32} : tensor<128xi32> 3036 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [128] ; Constancy: [128] ; ConstantValue: [None] 3037 - + // CHECK-NEXT: contiguity = [1], divisibility = [128], constancy = [128], constant_value = <none> 3038 - %3 = tt.splat %1 : (i32) -> tensor<128xi32> 3039 - - // CHECK-NEXT: Contiguity: [128] ; Divisibility: [128] ; Constancy: [1] ; ConstantValue: [None] 3040 - + // CHECK-NEXT: contiguity = [128], divisibility = [128], constancy = [1], constant_value = <none> 3041 - %4 = arith.addi %3, %2 : tensor<128xi32> 3042 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [16] ; Constancy: [128] ; ConstantValue: [None] 3043 - + // CHECK-NEXT: contiguity = [1], divisibility = [16], constancy = [128], constant_value = <none> 3044 - %5 = tt.splat %addr : (!tt.ptr<f32>) -> tensor<128x!tt.ptr<f32>> 3045 - - // CHECK-NEXT: Contiguity: [128] ; Divisibility: [16] ; Constancy: [1] ; ConstantValue: [None] 3046 - + // CHECK-NEXT: contiguity = [128], divisibility = [16], constancy = [1], constant_value = <none> 3047 - %6 = tt.addptr %5, %4 : tensor<128x!tt.ptr<f32>>, tensor<128xi32> 3048 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [16] ; Constancy: [128] ; ConstantValue: [None] 3049 - + // CHECK-NEXT: contiguity = [1], divisibility = [16], constancy = [128], constant_value = <none> 3050 - %9 = tt.splat %n : (i32) -> tensor<128xi32> 3051 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [16] ; ConstantValue: [None] 3052 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [16], constant_value = <none> 3053 - %mask = arith.cmpi slt, %4, %9 : tensor<128xi32> 3054 - - // CHECK-NEXT: Contiguity: [1] ; Divisibility: [1] ; Constancy: [1] ; ConstantValue: [None] 3055 - + // CHECK-NEXT: contiguity = [1], divisibility = [1], constancy = [1], constant_value = <none> 3056 - %cst = arith.constant dense<0.0> : tensor<128xf32> 3057 - tt.store %5, %cst, %mask : tensor<128xf32> 3058 - return 3059 - @@ -381,8 +381,8 @@ func @store_constant_align(%addr: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %n: 3060 - 3061 - // This IR is dumped from vecadd test. 3062 - // Note, the hint {tt.divisibility = 16 : i32} for %n_elements affects the alignment of mask. 3063 - -// CHECK-LABEL: vecadd_mask_align_16 3064 - -func @vecadd_mask_align_16(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %n_elements: i32 {tt.divisibility = 16 : i32}) { 3065 - +// CHECK-LABEL: @vecadd_mask_align_16 3066 - +func.func @vecadd_mask_align_16(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %n_elements: i32 {tt.divisibility = 16 : i32}) { 3067 - %c64_i32 = arith.constant 64 : i32 3068 - %0 = tt.get_program_id {axis = 0 : i32} : i32 3069 - %1 = arith.muli %0, %c64_i32 : i32 3070 - @@ -394,13 +394,13 @@ func @vecadd_mask_align_16(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %ar 3071 - %7 = tt.splat %arg1 : (!tt.ptr<f32>) -> tensor<64x!tt.ptr<f32>> 3072 - %8 = tt.addptr %7, %4 : tensor<64x!tt.ptr<f32>>, tensor<64xi32> 3073 - %9 = tt.splat %n_elements : (i32) -> tensor<64xi32> 3074 - - // CHECK: Contiguity: [1] ; Divisibility: [1] ; Constancy: [16] ; ConstantValue: [None] ( %{{.*}} = arith.cmpi slt, %{{.*}}, %{{.*}} : tensor<64xi32> ) 3075 - + // CHECK: arith.cmpi slt, %{{.*}} => contiguity = [1], divisibility = [1], constancy = [16], constant_value = <none> 3076 - %mask = arith.cmpi slt, %4, %9 : tensor<64xi32> 3077 - %11 = tt.load %6, %mask {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : tensor<64xf32> 3078 - %12 = tt.load %8, %mask {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : tensor<64xf32> 3079 - %13 = arith.addf %11, %12 : tensor<64xf32> 3080 - %14 = tt.splat %arg2 : (!tt.ptr<f32>) -> tensor<64x!tt.ptr<f32>> 3081 - - // CHECK: Contiguity: [64] ; Divisibility: [16] ; Constancy: [1] ; ConstantValue: [None] ( %{{.*}} = tt.addptr %{{.*}}, %{{.*}} : tensor<64x!tt.ptr<f32>>, tensor<64xi32> ) 3082 - + // CHECK: tt.addptr %{{.*}} => contiguity = [64], divisibility = [16], constancy = [1], constant_value = <none> 3083 - %15 = tt.addptr %14, %4 : tensor<64x!tt.ptr<f32>>, tensor<64xi32> 3084 - tt.store %15, %13, %mask : tensor<64xf32> 3085 - return 3086 - @@ -410,8 +410,8 @@ func @vecadd_mask_align_16(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %ar 3087 - 3088 - // This IR is dumped from vecadd test. 3089 - // Note, there is no divisibility hint for %n_elements, Triton should assume its divisibility to be 1 by default. 3090 - -// CHECK-LABEL: vecadd_mask_align_1 3091 - -func @vecadd_mask_align_1(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %n_elements: i32) { 3092 - +// CHECK-LABEL: @vecadd_mask_align_1 3093 - +func.func @vecadd_mask_align_1(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %n_elements: i32) { 3094 - %c64_i32 = arith.constant 64 : i32 3095 - %0 = tt.get_program_id {axis = 0 : i32} : i32 3096 - %1 = arith.muli %0, %c64_i32 : i32 3097 - @@ -423,7 +423,7 @@ func @vecadd_mask_align_1(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg 3098 - %7 = tt.splat %arg1 : (!tt.ptr<f32>) -> tensor<64x!tt.ptr<f32>> 3099 - %8 = tt.addptr %7, %4 : tensor<64x!tt.ptr<f32>>, tensor<64xi32> 3100 - %9 = tt.splat %n_elements : (i32) -> tensor<64xi32> 3101 - - // CHECK: Contiguity: [1] ; Divisibility: [1] ; Constancy: [1] ; ConstantValue: [None] ( %{{.*}} = arith.cmpi slt, %{{.*}}, %{{.*}} : tensor<64xi32> ) 3102 - + // CHECK: arith.cmpi slt, %{{.*}} => contiguity = [1], divisibility = [1], constancy = [1], constant_value = <none> 3103 - %10 = arith.cmpi slt, %4, %9 : tensor<64xi32> 3104 - %11 = tt.load %6, %10 {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : tensor<64xf32> 3105 - %12 = tt.load %8, %10 {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : tensor<64xf32> 3106 - diff --git a/test/Analysis/test-allocation.mlir b/test/Analysis/test-allocation.mlir 3107 - index efb00c404d..f79222aa7b 100644 3108 - --- a/test/Analysis/test-allocation.mlir 3109 - +++ b/test/Analysis/test-allocation.mlir 3110 - @@ -13,7 +13,7 @@ 3111 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3112 - 3113 - // CHECK-LABEL: matmul_loop 3114 - -func @matmul_loop(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>) { 3115 - +func.func @matmul_loop(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>) { 3116 - %a_ptr_init = tt.broadcast %A : (!tt.ptr<f16>) -> tensor<128x32x!tt.ptr<f16>, #AL> 3117 - %b_ptr_init = tt.broadcast %B : (!tt.ptr<f16>) -> tensor<32x128x!tt.ptr<f16>, #BL> 3118 - 3119 - @@ -46,7 +46,7 @@ func @matmul_loop(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B 3120 - 3121 - // Shared memory is available after a tensor's liveness range ends 3122 - // CHECK-LABEL: reusable 3123 - -func @reusable(%A : !tt.ptr<f16>) { 3124 - +func.func @reusable(%A : !tt.ptr<f16>) { 3125 - %cst1 = arith.constant dense<true> : tensor<128x32xi1, #AL> 3126 - %cst2 = arith.constant dense<0.000000e+00> : tensor<128x32xf16, #AL> 3127 - %cst3 = arith.constant dense<true> : tensor<32x128xi1, #AL> 3128 - @@ -78,7 +78,7 @@ func @reusable(%A : !tt.ptr<f16>) { 3129 - // %cst1->%cst4 3130 - // %cst3->%g->%h->%i 3131 - // CHECK-LABEL: preallocate 3132 - -func @preallocate(%A : !tt.ptr<f16>) { 3133 - +func.func @preallocate(%A : !tt.ptr<f16>) { 3134 - // CHECK: offset = 0, size = 512 3135 - %cst0 = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #A_SHARED> 3136 - // CHECK-NEXT: offset = 1024, size = 512 3137 - @@ -113,7 +113,7 @@ func @preallocate(%A : !tt.ptr<f16>) { 3138 - 3139 - // Unused tensors are immediately released 3140 - // CHECK-LABEL: unused 3141 - -func @unused(%A : !tt.ptr<f16>) { 3142 - +func.func @unused(%A : !tt.ptr<f16>) { 3143 - // CHECK: offset = 0, size = 1024 3144 - %cst0 = arith.constant dense<0.000000e+00> : tensor<32x16xf16, #A_SHARED> 3145 - // CHECK-NEXT: offset = 0, size = 512 3146 - @@ -128,7 +128,7 @@ func @unused(%A : !tt.ptr<f16>) { 3147 - 3148 - // cst0 is alive through the entire function, it cannot be released before the end of the function 3149 - // CHECK-LABEL: longlive 3150 - -func @longlive(%A : !tt.ptr<f16>) { 3151 - +func.func @longlive(%A : !tt.ptr<f16>) { 3152 - // CHECK: offset = 0, size = 512 3153 - %cst0 = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #A_SHARED> 3154 - // CHECK-NEXT: offset = 512, size = 512 3155 - @@ -156,7 +156,7 @@ func @longlive(%A : !tt.ptr<f16>) { 3156 - } 3157 - 3158 - // CHECK-LABEL: alloc 3159 - -func @alloc(%A : !tt.ptr<f16>) { 3160 - +func.func @alloc(%A : !tt.ptr<f16>) { 3161 - // CHECK: offset = 0, size = 512 3162 - %cst0 = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #A_SHARED> 3163 - %cst1 = arith.constant dense<0.000000e+00> : tensor<16x32xf16, #AL> 3164 - @@ -167,7 +167,7 @@ func @alloc(%A : !tt.ptr<f16>) { 3165 - } 3166 - 3167 - // CHECK-LABEL: scratch 3168 - -func @scratch() { 3169 - +func.func @scratch() { 3170 - %cst0 = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #AL> 3171 - // CHECK: scratch offset = 0, size = 512 3172 - %b = tt.reduce %cst0 {redOp = 1 : i32, axis = 0 : i32} : tensor<16x16xf16, #AL> -> tensor<16xf16, #sliceAd0> 3173 - @@ -176,7 +176,7 @@ func @scratch() { 3174 - } 3175 - 3176 - // CHECK-LABEL: trans 3177 - -func @trans(%A : !tt.ptr<f16>) { 3178 - +func.func @trans(%A : !tt.ptr<f16>) { 3179 - // CHECK: offset = 0, size = 1024 3180 - %tensor = arith.constant dense<0.000000e+00> : tensor<16x32xf16, #A_SHARED> 3181 - %b = tt.trans %tensor : (tensor<16x32xf16, #A_SHARED>) -> tensor<32x16xf16, #A_SHARED_T> 3182 - @@ -184,7 +184,7 @@ func @trans(%A : !tt.ptr<f16>) { 3183 - } 3184 - 3185 - // CHECK-LABEL: insert_slice_async 3186 - -func @insert_slice_async(%A : !tt.ptr<f16>, %i1 : i1) { 3187 - +func.func @insert_slice_async(%A : !tt.ptr<f16>, %i1 : i1) { 3188 - %a_ptr = tt.broadcast %A : (!tt.ptr<f16>) -> tensor<16x16x!tt.ptr<f16>, #AL> 3189 - %mask = tt.splat %i1 : (i1) -> tensor<16x16xi1, #AL> 3190 - %other = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #AL> 3191 - @@ -197,7 +197,7 @@ func @insert_slice_async(%A : !tt.ptr<f16>, %i1 : i1) { 3192 - } 3193 - 3194 - // CHECK-LABEL: extract_slice 3195 - -func @extract_slice(%A : !tt.ptr<f16>) { 3196 - +func.func @extract_slice(%A : !tt.ptr<f16>) { 3197 - // CHECK: offset = 0, size = 512 3198 - %cst0 = arith.constant dense<0.000000e+00> : tensor<1x16x16xf16, #A_SHARED> 3199 - %index = arith.constant 0 : index 3200 - @@ -209,7 +209,7 @@ func @extract_slice(%A : !tt.ptr<f16>) { 3201 - // B0 -> (B1) -> B0 3202 - // Memory used by B1 can be reused by B0. 3203 - // CHECK-LABEL: if 3204 - -func @if(%i1 : i1) { 3205 - +func.func @if(%i1 : i1) { 3206 - // CHECK: offset = 0, size = 512 3207 - %cst0 = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #A_SHARED> 3208 - // CHECK-NEXT: offset = 512, size = 512 3209 - @@ -233,7 +233,7 @@ func @if(%i1 : i1) { 3210 - // B0 -> (B1) -> (B2) -> B0 3211 - // Memory used by B0 cannot be reused by B1 or B2. 3212 - // CHECK-LABEL: if_else 3213 - -func @if_else(%i1 : i1) { 3214 - +func.func @if_else(%i1 : i1) { 3215 - // CHECK: offset = 0, size = 512 3216 - %cst0 = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #A_SHARED> 3217 - // CHECK-NEXT: offset = 512, size = 512 3218 - @@ -260,7 +260,7 @@ func @if_else(%i1 : i1) { 3219 - // Block arguments and yields are memory aliases that do not trigger a new 3220 - // allocation. 3221 - // CHECK-LABEL: for 3222 - -func @for(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>) { 3223 - +func.func @for(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>) { 3224 - // CHECK: offset = 0, size = 8192 3225 - %a_shared_init = arith.constant dense<0.00e+00> : tensor<128x32xf16, #A_SHARED> 3226 - // CHECK-NEXT: offset = 8192, size = 8192 3227 - @@ -275,7 +275,7 @@ func @for(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.p 3228 - } 3229 - 3230 - // CHECK-LABEL: for_if_slice 3231 - -func @for_if_slice(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>, %i1 : i1) { 3232 - +func.func @for_if_slice(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>, %i1 : i1) { 3233 - // CHECK: offset = 0, size = 8192 3234 - %a_shared_init = arith.constant dense<0.00e+00> : tensor<128x32xf16, #A_SHARED> 3235 - // CHECK-NEXT: offset = 8192, size = 8192 3236 - @@ -296,7 +296,7 @@ func @for_if_slice(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, % 3237 - 3238 - // c0 cannot be released in the loop 3239 - // CHECK-LABEL: for_use_ancestor 3240 - -func @for_use_ancestor(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>, %i1 : i1) { 3241 - +func.func @for_use_ancestor(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>, %i1 : i1) { 3242 - // CHECK: offset = 0, size = 8192 3243 - %a_shared_init = arith.constant dense<0.00e+00> : tensor<128x32xf16, #A_SHARED> 3244 - // CHECK-NEXT: offset = 8192, size = 8192 3245 - @@ -316,7 +316,7 @@ func @for_use_ancestor(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16 3246 - // a_shared_init, b_shared_init, and c_shared_init's liveness ranges are span over the entire function before cst2. 3247 - // So they cannot be reused by cst0 and cst1, but can be reused by cst2. 3248 - // CHECK-LABEL: for_if_for 3249 - -func @for_if_for(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>, %i1 : i1) { 3250 - +func.func @for_if_for(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>, %i1 : i1) { 3251 - // CHECK: offset = 0, size = 8192 3252 - %a_shared_init = arith.constant dense<0.00e+00> : tensor<128x32xf16, #A_SHARED> 3253 - // CHECK-NEXT: offset = 8192, size = 8192 3254 - diff --git a/test/Analysis/test-membar.mlir b/test/Analysis/test-membar.mlir 3255 - index 7199e5f53d..17880b2094 100644 3256 - --- a/test/Analysis/test-membar.mlir 3257 - +++ b/test/Analysis/test-membar.mlir 3258 - @@ -14,7 +14,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3259 - 3260 - // CHECK-LABEL: matmul_loop 3261 - // There shouldn't be any membar with the dot op encoding. 3262 - -func @matmul_loop(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>) { 3263 - +func.func @matmul_loop(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>) { 3264 - %a_ptr_init = tt.broadcast %A : (!tt.ptr<f16>) -> tensor<128x32x!tt.ptr<f16>, #AL> 3265 - %b_ptr_init = tt.broadcast %B : (!tt.ptr<f16>) -> tensor<32x128x!tt.ptr<f16>, #BL> 3266 - 3267 - @@ -42,7 +42,7 @@ func @matmul_loop(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B 3268 - } 3269 - 3270 - // CHECK-LABEL: raw_single_block 3271 - -func @raw_single_block(%A : !tt.ptr<f16>) { 3272 - +func.func @raw_single_block(%A : !tt.ptr<f16>) { 3273 - %cst1 = arith.constant dense<true> : tensor<128x32xi1, #AL> 3274 - %cst2 = arith.constant dense<0.000000e+00> : tensor<128x32xf16, #AL> 3275 - %a_ptr = tt.broadcast %A : (!tt.ptr<f16>) -> tensor<128x32x!tt.ptr<f16>, #AL> 3276 - @@ -54,7 +54,7 @@ func @raw_single_block(%A : !tt.ptr<f16>) { 3277 - } 3278 - 3279 - // CHECK-LABEL: war_single_block 3280 - -func @war_single_block(%A : !tt.ptr<f16>) { 3281 - +func.func @war_single_block(%A : !tt.ptr<f16>) { 3282 - %cst1 = arith.constant dense<true> : tensor<128x32xi1, #AL> 3283 - %cst2 = arith.constant dense<0.000000e+00> : tensor<128x32xf16, #AL> 3284 - %a_ptr = tt.broadcast %A : (!tt.ptr<f16>) -> tensor<128x32x!tt.ptr<f16>, #AL> 3285 - @@ -70,7 +70,7 @@ func @war_single_block(%A : !tt.ptr<f16>) { 3286 - } 3287 - 3288 - // CHECK-LABEL: scratch 3289 - -func @scratch() { 3290 - +func.func @scratch() { 3291 - %cst0 = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #A_SHARED> 3292 - // CHECK: Membar 1 3293 - %a = tt.cat %cst0, %cst0 {axis = 0} : (tensor<16x16xf16, #A_SHARED>, tensor<16x16xf16, #A_SHARED>) -> tensor<32x16xf16, #A_SHARED> 3294 - @@ -81,7 +81,7 @@ func @scratch() { 3295 - } 3296 - 3297 - // CHECK-LABEL: async_wait 3298 - -func @async_wait() { 3299 - +func.func @async_wait() { 3300 - %cst0 = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #A_SHARED> 3301 - // CHECK: Membar 1 3302 - %a = tt.cat %cst0, %cst0 {axis = 0} : (tensor<16x16xf16, #A_SHARED>, tensor<16x16xf16, #A_SHARED>) -> tensor<32x16xf16, #A_SHARED> 3303 - @@ -92,7 +92,7 @@ func @async_wait() { 3304 - } 3305 - 3306 - // CHECK-LABEL: alloc 3307 - -func @alloc() { 3308 - +func.func @alloc() { 3309 - %cst0 = triton_gpu.alloc_tensor : tensor<16x16xf16, #A_SHARED> 3310 - %a = tt.cat %cst0, %cst0 {axis = 0} : (tensor<16x16xf16, #A_SHARED>, tensor<16x16xf16, #A_SHARED>) -> tensor<32x16xf16, #A_SHARED> 3311 - // CHECK: Membar 2 3312 - @@ -101,7 +101,7 @@ func @alloc() { 3313 - } 3314 - 3315 - // CHECK-LABEL: extract_slice 3316 - -func @extract_slice() { 3317 - +func.func @extract_slice() { 3318 - %cst0 = arith.constant dense<0.000000e+00> : tensor<1x16x16xf16, #A_SHARED> 3319 - %index = arith.constant 0 : index 3320 - %cst1 = tensor.extract_slice %cst0[%index, 0, 0][1, 16, 16][1, 1, 1] : tensor<1x16x16xf16, #A_SHARED> to tensor<16x16xf16, #A_SHARED> 3321 - @@ -113,14 +113,14 @@ func @extract_slice() { 3322 - } 3323 - 3324 - // CHECK-LABEL: trans 3325 - -func @trans() { 3326 - +func.func @trans() { 3327 - %cst0 = arith.constant dense<0.000000e+00> : tensor<16x32xf16, #A_SHARED> 3328 - %b = tt.trans %cst0 : (tensor<16x32xf16, #A_SHARED>) -> tensor<32x16xf16, #A_SHARED_T> 3329 - return 3330 - } 3331 - 3332 - // CHECK-LABEL: insert_slice_async 3333 - -func @insert_slice_async(%A : !tt.ptr<f16>, %i1 : i1) { 3334 - +func.func @insert_slice_async(%A : !tt.ptr<f16>, %i1 : i1) { 3335 - %a_ptr = tt.broadcast %A : (!tt.ptr<f16>) -> tensor<16x16x!tt.ptr<f16>, #AL> 3336 - %mask = tt.splat %i1 : (i1) -> tensor<16x16xi1, #AL> 3337 - %other = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #AL> 3338 - @@ -135,7 +135,7 @@ func @insert_slice_async(%A : !tt.ptr<f16>, %i1 : i1) { 3339 - } 3340 - 3341 - // CHECK-LABEL: insert_slice 3342 - -func @insert_slice(%A : !tt.ptr<f16>, %i1 : i1) { 3343 - +func.func @insert_slice(%A : !tt.ptr<f16>, %i1 : i1) { 3344 - %a_ptr = tt.broadcast %A : (!tt.ptr<f16>) -> tensor<16x16x!tt.ptr<f16>, #AL> 3345 - %mask = tt.splat %i1 : (i1) -> tensor<16x16xi1, #AL> 3346 - %other = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #AL> 3347 - @@ -153,7 +153,7 @@ func @insert_slice(%A : !tt.ptr<f16>, %i1 : i1) { 3348 - 3349 - // If branch inserted a barrier for %cst0 and %cst1, but else didn't, then the barrier should be inserted in the parent region 3350 - // CHECK-LABEL: multi_blocks 3351 - -func @multi_blocks(%i1 : i1) { 3352 - +func.func @multi_blocks(%i1 : i1) { 3353 - %cst0 = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #A_SHARED> 3354 - %cst1 = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #A_SHARED> 3355 - scf.if %i1 { 3356 - @@ -174,7 +174,7 @@ func @multi_blocks(%i1 : i1) { 3357 - 3358 - // Both branches inserted a barrier for %cst0 and %cst1, then the barrier doesn't need to be inserted in the parent region 3359 - // CHECK-LABEL: multi_blocks_join_barrier 3360 - -func @multi_blocks_join_barrier(%i1 : i1) { 3361 - +func.func @multi_blocks_join_barrier(%i1 : i1) { 3362 - %cst0 = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #A_SHARED> 3363 - %cst1 = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #A_SHARED> 3364 - scf.if %i1 { 3365 - @@ -192,7 +192,7 @@ func @multi_blocks_join_barrier(%i1 : i1) { 3366 - 3367 - // Read yielded tensor requires a barrier 3368 - // CHECK-LABEL: multi_blocks_yield 3369 - -func @multi_blocks_yield(%i1 : i1) { 3370 - +func.func @multi_blocks_yield(%i1 : i1) { 3371 - %cst0 = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #A_SHARED> 3372 - %cst1 = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #A_SHARED> 3373 - %a = scf.if %i1 -> (tensor<32x16xf16, #A_SHARED>) { 3374 - @@ -212,7 +212,7 @@ func @multi_blocks_yield(%i1 : i1) { 3375 - 3376 - // Conservatively add a barrier as if the branch (%i1) is never taken 3377 - // CHECK-LABEL: multi_blocks_noelse 3378 - -func @multi_blocks_noelse(%i1 : i1) { 3379 - +func.func @multi_blocks_noelse(%i1 : i1) { 3380 - %cst0 = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #A_SHARED> 3381 - %cst1 = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #A_SHARED> 3382 - scf.if %i1 { 3383 - @@ -226,7 +226,7 @@ func @multi_blocks_noelse(%i1 : i1) { 3384 - 3385 - // Conservatively add a barrier as if the branch (%i2) is never taken 3386 - // CHECK-LABEL: multi_blocks_nested_scf 3387 - -func @multi_blocks_nested_scf(%i1 : i1, %i2 : i1) { 3388 - +func.func @multi_blocks_nested_scf(%i1 : i1, %i2 : i1) { 3389 - %cst0 = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #A_SHARED> 3390 - %cst1 = arith.constant dense<0.000000e+00> : tensor<16x16xf16, #A_SHARED> 3391 - scf.if %i1 { 3392 - @@ -247,7 +247,7 @@ func @multi_blocks_nested_scf(%i1 : i1, %i2 : i1) { 3393 - } 3394 - 3395 - // CHECK-LABEL: for 3396 - -func @for(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>) { 3397 - +func.func @for(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>) { 3398 - %a_shared_init = arith.constant dense<0.00e+00> : tensor<128x32xf16, #A_SHARED> 3399 - %b_shared_init = arith.constant dense<0.00e+00> : tensor<128x32xf16, #A_SHARED> 3400 - %c_shared_init = arith.constant dense<0.00e+00> : tensor<128x32xf16, #A_SHARED> 3401 - @@ -262,7 +262,7 @@ func @for(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.p 3402 - // Although a_shared and b_shared are synced before entering the loop, 3403 - // they are reassociated with aliases (c_shared) and thus require a barrier. 3404 - // CHECK-LABEL: for_alias 3405 - -func @for_alias(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>) { 3406 - +func.func @for_alias(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>) { 3407 - %a_shared_init = arith.constant dense<0.00e+00> : tensor<128x32xf16, #A_SHARED> 3408 - %b_shared_init = arith.constant dense<0.00e+00> : tensor<128x32xf16, #A_SHARED> 3409 - // CHECK-NEXT: Membar 2 3410 - @@ -282,7 +282,7 @@ func @for_alias(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : 3411 - // Although cst2 is not an argument of scf.yield, its memory is reused by cst1. 3412 - // So we need a barrier both before and after cst1 3413 - // CHECK-LABEL: for_reuse 3414 - -func @for_reuse(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>) { 3415 - +func.func @for_reuse(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>) { 3416 - %a_shared_init = arith.constant dense<0.00e+00> : tensor<128x32xf16, #A_SHARED> 3417 - %b_shared_init = arith.constant dense<0.00e+00> : tensor<128x32xf16, #A_SHARED> 3418 - // CHECK-NEXT: Membar 2 3419 - @@ -302,7 +302,7 @@ func @for_reuse(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : 3420 - 3421 - 3422 - // CHECK-LABEL: for_reuse_nested 3423 - -func @for_reuse_nested(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>) { 3424 - +func.func @for_reuse_nested(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>) { 3425 - %a_shared_init = arith.constant dense<0.00e+00> : tensor<128x32xf16, #A_SHARED> 3426 - %b_shared_init = arith.constant dense<0.00e+00> : tensor<128x32xf16, #A_SHARED> 3427 - // CHECK-NEXT: Membar 2 3428 - diff --git a/test/Conversion/triton_ops.mlir b/test/Conversion/triton_ops.mlir 3429 - index e9ee502435..0e979b148d 100644 3430 - --- a/test/Conversion/triton_ops.mlir 3431 - +++ b/test/Conversion/triton_ops.mlir 3432 - @@ -1,6 +1,6 @@ 3433 - // RUN: triton-opt %s | FileCheck %s 3434 - 3435 - -func @cast_ops(%scalar_ptr: !tt.ptr<f32>, %scalar_f32: f32, %scalar_i64: i64) { 3436 - +func.func @cast_ops(%scalar_ptr: !tt.ptr<f32>, %scalar_f32: f32, %scalar_i64: i64) { 3437 - // scalar -> scalar 3438 - // CHECK: i64 -> !tt.ptr<f32> 3439 - %0 = tt.int_to_ptr %scalar_i64 : i64 -> !tt.ptr<f32> 3440 - @@ -35,7 +35,7 @@ func @cast_ops(%scalar_ptr: !tt.ptr<f32>, %scalar_f32: f32, %scalar_i64: i64) { 3441 - return 3442 - } 3443 - 3444 - -func @addptr_ops(%scalar_ptr: !tt.ptr<f32>, %scalar_i32: i32) { 3445 - +func.func @addptr_ops(%scalar_ptr: !tt.ptr<f32>, %scalar_i32: i32) { 3446 - // scalar -> scalar 3447 - // CHECK: !tt.ptr<f32> 3448 - %0 = tt.addptr %scalar_ptr, %scalar_i32 : !tt.ptr<f32>, i32 3449 - @@ -54,7 +54,7 @@ func @addptr_ops(%scalar_ptr: !tt.ptr<f32>, %scalar_i32: i32) { 3450 - return 3451 - } 3452 - 3453 - -func @load_store_ops_scalar(%ptr: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %mask : i1) { 3454 - +func.func @load_store_ops_scalar(%ptr: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %mask : i1) { 3455 - // Test if Load/Store ops can handle scalar values 3456 - %other = arith.constant 0.0e+0 : f32 3457 - 3458 - @@ -76,7 +76,7 @@ func @load_store_ops_scalar(%ptr: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %ma 3459 - return 3460 - } 3461 - 3462 - -func @reduce_ops_infer(%ptr: !tt.ptr<f32>, %v : tensor<1x2x4xf32>) { 3463 - +func.func @reduce_ops_infer(%ptr: !tt.ptr<f32>, %v : tensor<1x2x4xf32>) { 3464 - // Test if reduce ops infer types correctly 3465 - 3466 - // CHECK: %{{.*}} = tt.reduce %{{.*}} -> tensor<2x4xf32> 3467 - @@ -101,7 +101,7 @@ func @reduce_ops_infer(%ptr: !tt.ptr<f32>, %v : tensor<1x2x4xf32>) { 3468 - return 3469 - } 3470 - 3471 - -func @dot_ops_infer(%ptr: !tt.ptr<f32>, %v : f32) { 3472 - +func.func @dot_ops_infer(%ptr: !tt.ptr<f32>, %v : f32) { 3473 - // Test if reduce ops infer types correctly 3474 - %v128x32 = tt.splat %v : (f32) -> tensor<128x32xf32> 3475 - %v32x128 = tt.splat %v : (f32) -> tensor<32x128xf32> 3476 - diff --git a/test/Conversion/triton_to_tritongpu.mlir b/test/Conversion/triton_to_tritongpu.mlir 3477 - index a160bc8815..b461ca542f 100644 3478 - --- a/test/Conversion/triton_to_tritongpu.mlir 3479 - +++ b/test/Conversion/triton_to_tritongpu.mlir 3480 - @@ -1,6 +1,6 @@ 3481 - // RUN: triton-opt %s -split-input-file -convert-triton-to-tritongpu=num-warps=2 | FileCheck %s 3482 - 3483 - -func @ops() { 3484 - +func.func @ops() { 3485 - // CHECK: module attributes {"triton_gpu.num-warps" = 2 : i32} {{.*}} 3486 - %a = arith.constant dense<1.00e+00> : tensor<128x32xf16> 3487 - %b = arith.constant dense<2.00e+00> : tensor<32x128xf16> 3488 - @@ -11,7 +11,7 @@ func @ops() { 3489 - 3490 - // ----- 3491 - 3492 - -func @load_ops(%ptr: !tt.ptr<f32> {tt.divisibility = 16 : i32}) { 3493 - +func.func @load_ops(%ptr: !tt.ptr<f32> {tt.divisibility = 16 : i32}) { 3494 - // Test if LoadOp is lowered properly (see #771) 3495 - %ptrs = tt.splat %ptr : (!tt.ptr<f32>) -> tensor<128x!tt.ptr<f32>> 3496 - %mask = arith.constant dense<true> : tensor<128xi1> 3497 - @@ -30,7 +30,7 @@ func @load_ops(%ptr: !tt.ptr<f32> {tt.divisibility = 16 : i32}) { 3498 - 3499 - // ----- 3500 - 3501 - -func @reduce_ops(%ptr: !tt.ptr<f32> {tt.divisibility = 16 : i32}) { 3502 - +func.func @reduce_ops(%ptr: !tt.ptr<f32> {tt.divisibility = 16 : i32}) { 3503 - // Test if the total number of threadsPerWarp is 32 3504 - // Test if the total number of warps is 2 3505 - // CHECK: #blocked0 = #triton_gpu.blocked<{sizePerThread = [1, 1], threadsPerWarp = [4, 8], warpsPerCTA = [1, 2], order = [0, 1]}> 3506 - diff --git a/test/Conversion/tritongpu_to_llvm.mlir b/test/Conversion/tritongpu_to_llvm.mlir 3507 - index e9e7d5a340..507b362c99 100644 3508 - --- a/test/Conversion/tritongpu_to_llvm.mlir 3509 - +++ b/test/Conversion/tritongpu_to_llvm.mlir 3510 - @@ -4,7 +4,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3511 - // CHECK: llvm.func @test_empty_kernel(%arg0: i32, %arg1: !llvm.ptr<f16, 1>) 3512 - // Here the 128 comes from the 4 in module attribute multiples 32 3513 - // CHECK: attributes {nvvm.kernel = 1 : ui1, nvvm.maxntid = 128 : i32} {{.*}} 3514 - - func @test_empty_kernel(%lb : index, %A : !tt.ptr<f16>) { 3515 - + func.func @test_empty_kernel(%lb : index, %A : !tt.ptr<f16>) { 3516 - // CHECK: llvm.return 3517 - return 3518 - } 3519 - @@ -15,7 +15,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3520 - #blocked0 = #triton_gpu.blocked<{sizePerThread = [1], threadsPerWarp = [32], warpsPerCTA = [4], order = [0]}> 3521 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3522 - // CHECK-LABEL: basic_load 3523 - - func @basic_load(%a_ptr_init : tensor<256x!tt.ptr<f32>, #blocked0>, %cst : tensor<256xi1, #blocked0>, %cst_0 : tensor<256xf32, #blocked0>) { 3524 - + func.func @basic_load(%a_ptr_init : tensor<256x!tt.ptr<f32>, #blocked0>, %cst : tensor<256xi1, #blocked0>, %cst_0 : tensor<256xf32, #blocked0>) { 3525 - // CHECK: llvm.inline_asm 3526 - // CHECK: llvm.inline_asm 3527 - %1 = tt.load %a_ptr_init, %cst, %cst_0 {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : tensor<256xf32, #blocked0> 3528 - @@ -28,7 +28,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3529 - #blocked0 = #triton_gpu.blocked<{sizePerThread = [2], threadsPerWarp = [32], warpsPerCTA = [4], order = [0]}> 3530 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3531 - // CHECK-LABEL: vectorized_load 3532 - - func @vectorized_load(%a_ptr_init : tensor<256x!tt.ptr<f32>, #blocked0>, %cst : tensor<256xi1, #blocked0>, %cst_0 : tensor<256xf32, #blocked0>) { 3533 - + func.func @vectorized_load(%a_ptr_init : tensor<256x!tt.ptr<f32>, #blocked0>, %cst : tensor<256xi1, #blocked0>, %cst_0 : tensor<256xf32, #blocked0>) { 3534 - // CHECK: llvm.inline_asm 3535 - // CHECK-SAME: ld.global.b32 3536 - // CHECK: llvm.inline_asm 3537 - @@ -43,7 +43,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3538 - #blocked0 = #triton_gpu.blocked<{sizePerThread = [8], threadsPerWarp = [32], warpsPerCTA = [1], order = [0]}> 3539 - module attributes {"triton_gpu.num-warps" = 1 : i32} { 3540 - // CHECK-LABEL: vectorized_load_f16 3541 - - func @vectorized_load_f16(%a_ptr_init: tensor<256x!tt.ptr<f16>, #blocked0>, %cst : tensor<256xi1, #blocked0>, %cst_0 : tensor<256xf16, #blocked0>) { 3542 - + func.func @vectorized_load_f16(%a_ptr_init: tensor<256x!tt.ptr<f16>, #blocked0>, %cst : tensor<256xi1, #blocked0>, %cst_0 : tensor<256xf16, #blocked0>) { 3543 - // CHECK: llvm.inline_asm 3544 - // CHECK-SAME: ld.global.b16 3545 - // CHECK: llvm.inline_asm 3546 - @@ -59,7 +59,7 @@ module attributes {"triton_gpu.num-warps" = 1 : i32} { 3547 - #blocked0 = #triton_gpu.blocked<{sizePerThread = [1], threadsPerWarp = [32], warpsPerCTA = [8], order = [0]}> 3548 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3549 - // CHECK-LABEL: masked_load_const_other 3550 - - func @masked_load_const_other(%a_ptr_init : tensor<256x!tt.ptr<f32>, #blocked0>, %cst : tensor<256xi1, #blocked0>) { 3551 - + func.func @masked_load_const_other(%a_ptr_init : tensor<256x!tt.ptr<f32>, #blocked0>, %cst : tensor<256xi1, #blocked0>) { 3552 - %cst_0 = arith.constant dense<0.000000e+00> : tensor<256xf32, #blocked0> 3553 - %1 = tt.load %a_ptr_init, %cst, %cst_0 {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : tensor<256xf32, #blocked0> 3554 - return 3555 - @@ -72,7 +72,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3556 - #blocked0 = #triton_gpu.blocked<{sizePerThread = [4], threadsPerWarp = [32], warpsPerCTA = [8], order = [0]}> 3557 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3558 - // CHECK-LABEL: masked_load_const_other_vec 3559 - - func @masked_load_const_other_vec(%a_ptr_init : tensor<256x!tt.ptr<f32>, #blocked0>, %cst : tensor<256xi1, #blocked0>) { 3560 - + func.func @masked_load_const_other_vec(%a_ptr_init : tensor<256x!tt.ptr<f32>, #blocked0>, %cst : tensor<256xi1, #blocked0>) { 3561 - %cst_0 = arith.constant dense<0.000000e+00> : tensor<256xf32, #blocked0> 3562 - %1 = tt.load %a_ptr_init, %cst, %cst_0 {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : tensor<256xf32, #blocked0> 3563 - return 3564 - @@ -84,7 +84,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3565 - #blocked0 = #triton_gpu.blocked<{sizePerThread = [1], threadsPerWarp = [32], warpsPerCTA = [2], order = [0]}> 3566 - module attributes {"triton_gpu.num-warps" = 2 : i32} { 3567 - // CHECK-LABEL: global_load_store_no_vec 3568 - - func @global_load_store_no_vec(%arg0: !tt.ptr<f32> {tt.divisibility = 4 : i32}, %arg1: !tt.ptr<f32> {tt.divisibility = 4 : i32}, %arg2: !tt.ptr<f32> {tt.divisibility = 4 : i32}, %arg3: i32) { 3569 - + func.func @global_load_store_no_vec(%arg0: !tt.ptr<f32> {tt.divisibility = 4 : i32}, %arg1: !tt.ptr<f32> {tt.divisibility = 4 : i32}, %arg2: !tt.ptr<f32> {tt.divisibility = 4 : i32}, %arg3: i32) { 3570 - %c256_i32 = arith.constant 256 : i32 3571 - %0 = tt.get_program_id {axis = 0 : i32} : i32 3572 - %1 = arith.muli %0, %c256_i32 : i32 3573 - @@ -128,7 +128,7 @@ module attributes {"triton_gpu.num-warps" = 2 : i32} { 3574 - #blocked0 = #triton_gpu.blocked<{sizePerThread = [4], threadsPerWarp = [32], warpsPerCTA = [2], order = [0]}> 3575 - module attributes {"triton_gpu.num-warps" = 2 : i32} { 3576 - // CHECK-LABEL: global_load_store_vec4 3577 - - func @global_load_store_vec4(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg3: i32) { 3578 - + func.func @global_load_store_vec4(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg3: i32) { 3579 - %c256_i32 = arith.constant 256 : i32 3580 - %0 = tt.get_program_id {axis = 0 : i32} : i32 3581 - %1 = arith.muli %0, %c256_i32 : i32 3582 - @@ -165,7 +165,7 @@ module attributes {"triton_gpu.num-warps" = 2 : i32} { 3583 - #blocked = #triton_gpu.blocked<{sizePerThread = [1], threadsPerWarp = [32], warpsPerCTA = [2], order = [0]}> 3584 - // Note, the %n_elements doesn't have a "tt.divisibility" hint, so Triton assumes it's divisibility is 1, this should effect the mask's alignment and further restrict the load/store ops' vector width to be 1. 3585 - module attributes {"triton_gpu.num-warps" = 2 : i32} { 3586 - - func @vecadd_masked_vec1(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %n_elements: i32) { 3587 - + func.func @vecadd_masked_vec1(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %n_elements: i32) { 3588 - %c64_i32 = arith.constant 64 : i32 3589 - %0 = tt.get_program_id {axis = 0 : i32} : i32 3590 - %1 = arith.muli %0, %c64_i32 : i32 3591 - @@ -195,7 +195,7 @@ module attributes {"triton_gpu.num-warps" = 2 : i32} { 3592 - #blocked0 = #triton_gpu.blocked<{sizePerThread = [8], threadsPerWarp = [32], warpsPerCTA = [1], order = [0]}> 3593 - module attributes {"triton_gpu.num-warps" = 1 : i32} { 3594 - // CHECK-LABEL: global_load_store_vec2 3595 - - func @global_load_store_vec2(%arg0: !tt.ptr<f32> {tt.divisibility = 8 : i32}, %arg1: !tt.ptr<f32> {tt.divisibility = 8 : i32}, %arg2: !tt.ptr<f32> {tt.divisibility = 8 : i32}, %arg3: i32) { 3596 - + func.func @global_load_store_vec2(%arg0: !tt.ptr<f32> {tt.divisibility = 8 : i32}, %arg1: !tt.ptr<f32> {tt.divisibility = 8 : i32}, %arg2: !tt.ptr<f32> {tt.divisibility = 8 : i32}, %arg3: i32) { 3597 - %c256_i32 = arith.constant 256 : i32 3598 - %0 = tt.get_program_id {axis = 0 : i32} : i32 3599 - %1 = arith.muli %0, %c256_i32 : i32 3600 - @@ -240,7 +240,7 @@ module attributes {"triton_gpu.num-warps" = 1 : i32} { 3601 - #blocked0 = #triton_gpu.blocked<{sizePerThread = [8], threadsPerWarp = [32], warpsPerCTA = [1], order = [0]}> 3602 - module attributes {"triton_gpu.num-warps" = 1 : i32} { 3603 - // CHECK-LABEL: global_load_store_vec8 3604 - - func @global_load_store_vec8(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg3: i32) { 3605 - + func.func @global_load_store_vec8(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg3: i32) { 3606 - %c256_i32 = arith.constant 256 : i32 3607 - %0 = tt.get_program_id {axis = 0 : i32} : i32 3608 - %1 = arith.muli %0, %c256_i32 : i32 3609 - @@ -283,7 +283,7 @@ module attributes {"triton_gpu.num-warps" = 1 : i32} { 3610 - #blocked2 = #triton_gpu.blocked<{sizePerThread = [1, 1], threadsPerWarp = [32, 1], warpsPerCTA = [4, 1], order = [0, 1]}> 3611 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3612 - // CHECK-LABEL: basic_view_broadcast 3613 - - func @basic_view_broadcast(%arg : tensor<256xf32,#blocked0>) { 3614 - + func.func @basic_view_broadcast(%arg : tensor<256xf32,#blocked0>) { 3615 - // CHECK: llvm.mlir.undef 3616 - // CHECK: %[[T0:.*]] = llvm.extractvalue 3617 - // CHECK: %[[T1:.*]] = llvm.extractvalue 3618 - @@ -307,7 +307,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3619 - #blocked0 = #triton_gpu.blocked<{sizePerThread = [2], threadsPerWarp = [32], warpsPerCTA = [1], order = [0]}> 3620 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3621 - // CHECK-LABEL: basic_make_range 3622 - - func @basic_make_range() { 3623 - + func.func @basic_make_range() { 3624 - // CHECK: nvvm.read.ptx.sreg.tid.x 3625 - // CHECK: llvm.mlir.undef 3626 - // CHECK: llvm.insertvalue 3627 - @@ -322,7 +322,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3628 - #blocked0 = #triton_gpu.blocked<{sizePerThread = [1], threadsPerWarp = [32], warpsPerCTA = [4], order = [0]}> 3629 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3630 - // CHECK-LABEL: basic_addf 3631 - - func @basic_addf(%arg0 : tensor<256xf32,#blocked0>, %arg1 : tensor<256xf32,#blocked0>) { 3632 - + func.func @basic_addf(%arg0 : tensor<256xf32,#blocked0>, %arg1 : tensor<256xf32,#blocked0>) { 3633 - // CHECK: llvm.fadd 3634 - // CHECK: llvm.fadd 3635 - %1 = arith.addf %arg0, %arg1 : tensor<256xf32,#blocked0> 3636 - @@ -335,7 +335,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3637 - #blocked0 = #triton_gpu.blocked<{sizePerThread = [1], threadsPerWarp = [32], warpsPerCTA = [4], order = [0]}> 3638 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3639 - // CHECK-LABEL: basic_addi 3640 - - func @basic_addi(%arg0 : tensor<256xi32,#blocked0>, %arg1 : tensor<256xi32,#blocked0>) { 3641 - + func.func @basic_addi(%arg0 : tensor<256xi32,#blocked0>, %arg1 : tensor<256xi32,#blocked0>) { 3642 - // CHECK: llvm.add 3643 - // CHECK: llvm.add 3644 - %1 = arith.addi %arg0, %arg1 : tensor<256xi32,#blocked0> 3645 - @@ -347,7 +347,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3646 - 3647 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3648 - // CHECK-LABEL: basic_program_id 3649 - - func @basic_program_id() { 3650 - + func.func @basic_program_id() { 3651 - // CHECK: nvvm.read.ptx.sreg.ctaid.x : i32 3652 - %0 = tt.get_program_id {axis = 0 : i32} : i32 3653 - return 3654 - @@ -359,7 +359,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3655 - #blocked0 = #triton_gpu.blocked<{sizePerThread = [1], threadsPerWarp = [32], warpsPerCTA = [4], order = [0]}> 3656 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3657 - // CHECK-LABEL: basic_addptr 3658 - - func @basic_addptr(%arg0 : tensor<256x!tt.ptr<f32>,#blocked0>, %arg1 : tensor<256xi32,#blocked0>) { 3659 - + func.func @basic_addptr(%arg0 : tensor<256x!tt.ptr<f32>,#blocked0>, %arg1 : tensor<256xi32,#blocked0>) { 3660 - // CHECK: llvm.getelementptr 3661 - // CHECK: llvm.getelementptr 3662 - %0 = tt.addptr %arg0, %arg1 : tensor<256x!tt.ptr<f32>, #blocked0>, tensor<256xi32, #blocked0> 3663 - @@ -373,7 +373,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3664 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3665 - // CHECK: llvm.mlir.global external @global_smem 3666 - // CHECK-LABEL: basic_alloc_tensor 3667 - - func @basic_alloc_tensor() { 3668 - + func.func @basic_alloc_tensor() { 3669 - // CHECK: llvm.mlir.addressof @global_smem 3670 - // CHECK-NEXT: llvm.bitcast 3671 - // CHECK-NEXT: llvm.mlir.constant 3672 - @@ -390,7 +390,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3673 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3674 - // CHECK: llvm.mlir.global external @global_smem 3675 - // CHECK-LABEL: basic_extract_slice 3676 - - func @basic_extract_slice() { 3677 - + func.func @basic_extract_slice() { 3678 - // CHECK: llvm.mlir.addressof @global_smem 3679 - // CHECK: llvm.extractvalue 3680 - // CHECK-NEXT: llvm.extractvalue 3681 - @@ -423,7 +423,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3682 - 3683 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3684 - // CHECK-LABEL: basic_async_wait 3685 - - func @basic_async_wait() { 3686 - + func.func @basic_async_wait() { 3687 - // CHECK: cp.async.wait_group 0x4 3688 - triton_gpu.async_wait {num = 4: i32} 3689 - return 3690 - @@ -442,7 +442,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3691 - #A = #triton_gpu.shared<{vec = 8, perPhase = 1, maxPhase = 4, order = [1, 0]}> 3692 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3693 - // CHECK-LABEL: basic_insert_slice_async_fallback 3694 - - func @basic_insert_slice_async_fallback(%arg0: !tt.ptr<f16> {tt.divisibility = 1 : i32}) { 3695 - + func.func @basic_insert_slice_async_fallback(%arg0: !tt.ptr<f16> {tt.divisibility = 1 : i32}) { 3696 - %off0_ = tt.make_range {end = 16 : i32, start = 0 : i32} : tensor<16xi32, #slice2d1> 3697 - %off1_ = tt.make_range {end = 32 : i32, start = 0 : i32} : tensor<64xi32, #slice3d0> 3698 - %off0 = tt.expand_dims %off0_ {axis = 1 : i32} : (tensor<16xi32, #slice2d1>) -> tensor<16x1xi32, #block2> 3699 - @@ -481,7 +481,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3700 - #A = #triton_gpu.shared<{vec = 8, perPhase = 1, maxPhase = 4, order = [1, 0]}> 3701 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3702 - // CHECK-LABEL: basic_insert_slice_async_v4 3703 - - func @basic_insert_slice_async_v4(%arg0: !tt.ptr<f32> {tt.divisibility = 32 : i32}) { 3704 - + func.func @basic_insert_slice_async_v4(%arg0: !tt.ptr<f32> {tt.divisibility = 32 : i32}) { 3705 - %off0_ = tt.make_range {end = 16 : i32, start = 0 : i32} : tensor<16xi32, #slice2d1> 3706 - %off1_ = tt.make_range {end = 32 : i32, start = 0 : i32} : tensor<64xi32, #slice3d0> 3707 - %off0 = tt.expand_dims %off0_ {axis = 1 : i32} : (tensor<16xi32, #slice2d1>) -> tensor<16x1xi32, #block2> 3708 - @@ -523,7 +523,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3709 - #A = #triton_gpu.shared<{vec = 1, perPhase = 1, maxPhase = 4, order = [1, 0]}> 3710 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3711 - // CHECK-LABEL: basic_insert_slice_async_v1 3712 - - func @basic_insert_slice_async_v1(%arg0: !tt.ptr<f32> {tt.divisibility = 4 : i32}) { 3713 - + func.func @basic_insert_slice_async_v1(%arg0: !tt.ptr<f32> {tt.divisibility = 4 : i32}) { 3714 - %off0_ = tt.make_range {end = 16 : i32, start = 0 : i32} : tensor<16xi32, #slice2d1> 3715 - %off1_ = tt.make_range {end = 32 : i32, start = 0 : i32} : tensor<32xi32, #slice3d0> 3716 - %off0 = tt.expand_dims %off0_ {axis = 1 : i32} : (tensor<16xi32, #slice2d1>) -> tensor<16x1xi32, #block2> 3717 - @@ -568,7 +568,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3718 - #A = #triton_gpu.shared<{vec = 1, perPhase = 1, maxPhase = 4, order = [1, 0]}> 3719 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3720 - // CHECK-LABEL: basic_insert_slice_async_v1_multictas 3721 - - func @basic_insert_slice_async_v1_multictas(%arg0: !tt.ptr<f32> {tt.divisibility = 4 : i32}) { 3722 - + func.func @basic_insert_slice_async_v1_multictas(%arg0: !tt.ptr<f32> {tt.divisibility = 4 : i32}) { 3723 - %off0_ = tt.make_range {end = 32 : i32, start = 0 : i32} : tensor<32xi32, #slice2d1> 3724 - %off1_ = tt.make_range {end = 32 : i32, start = 0 : i32} : tensor<32xi32, #slice3d0> 3725 - %off0 = tt.expand_dims %off0_ {axis = 1 : i32} : (tensor<32xi32, #slice2d1>) -> tensor<32x1xi32, #block2> 3726 - @@ -619,7 +619,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3727 - #blocked0 = #triton_gpu.blocked<{sizePerThread = [1], threadsPerWarp = [32], warpsPerCTA = [4], order = [0]}> 3728 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3729 - // CHECK: basic_splat 3730 - - func @basic_splat(%ptr: !tt.ptr<f32>) { 3731 - + func.func @basic_splat(%ptr: !tt.ptr<f32>) { 3732 - // CHECK: llvm.mlir.undef 3733 - // CHECK: llvm.insertvalue 3734 - // CHECK: llvm.insertvalue 3735 - @@ -633,7 +633,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3736 - #blocked0 = #triton_gpu.blocked<{sizePerThread = [1], threadsPerWarp = [32], warpsPerCTA = [4], order = [0]}> 3737 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3738 - // CHECK-LABEL: basic_store 3739 - - func @basic_store(%ptrs: tensor<256x!tt.ptr<f32>, #blocked0>, %vals: tensor<256xf32, #blocked0>, %mask: tensor<256xi1, #blocked0>) { 3740 - + func.func @basic_store(%ptrs: tensor<256x!tt.ptr<f32>, #blocked0>, %vals: tensor<256xf32, #blocked0>, %mask: tensor<256xi1, #blocked0>) { 3741 - // CHECK: llvm.inline_asm 3742 - // CHECK-SAME: st.global.b32 [ ${{.*}} + 0 ], { ${{.*}} }; 3743 - // CHECK: llvm.inline_asm 3744 - @@ -650,7 +650,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3745 - module attributes {"triton_gpu.num-warps" = 1 : i32} { 3746 - // CHECK: llvm.mlir.global external @global_smem() {addr_space = 3 : i32} : !llvm.array<0 x i8> 3747 - // CHECK-LABEL: convert_layout_blocked_blocked 3748 - - func @convert_layout_blocked_blocked(%arg0: tensor<16x16xf32, #blocked0>) { 3749 - + func.func @convert_layout_blocked_blocked(%arg0: tensor<16x16xf32, #blocked0>) { 3750 - // CHECK: llvm.mlir.addressof @global_smem 3751 - // CHECK: llvm.store 3752 - // CHECK-SAME: !llvm.ptr<vector<1xf32>, 3> 3753 - @@ -697,7 +697,7 @@ module attributes {"triton_gpu.num-warps" = 1 : i32} { 3754 - module attributes {"triton_gpu.num-warps" = 1 : i32} { 3755 - // CHECK: llvm.mlir.global external @global_smem() {addr_space = 3 : i32} : !llvm.array<0 x i8> 3756 - // CHECK-LABEL: convert_layout_blocked_blocked_vec 3757 - - func @convert_layout_blocked_blocked_vec(%arg0: tensor<16x16xf32, #blocked0>) { 3758 - + func.func @convert_layout_blocked_blocked_vec(%arg0: tensor<16x16xf32, #blocked0>) { 3759 - // CHECK: llvm.mlir.addressof @global_smem 3760 - // CHECK: llvm.store 3761 - // CHECK-SAME: !llvm.ptr<vector<4xf32>, 3> 3762 - @@ -720,7 +720,7 @@ module attributes {"triton_gpu.num-warps" = 1 : i32} { 3763 - module attributes {"triton_gpu.num-warps" = 1 : i32} { 3764 - // CHECK: llvm.mlir.global external @global_smem() {addr_space = 3 : i32} : !llvm.array<0 x i8> 3765 - // CHECK-LABEL: convert_layout_blocked_blocked_multi_rep 3766 - - func @convert_layout_blocked_blocked_multi_rep(%arg0: tensor<16x16xf32, #blocked0>) { 3767 - + func.func @convert_layout_blocked_blocked_multi_rep(%arg0: tensor<16x16xf32, #blocked0>) { 3768 - // CHECK: llvm.mlir.addressof @global_smem 3769 - // CHECK: llvm.store 3770 - // CHECK-SAME: !llvm.ptr<vector<4xf32>, 3> 3771 - @@ -751,7 +751,7 @@ module attributes {"triton_gpu.num-warps" = 1 : i32} { 3772 - #dot_operand_b = #triton_gpu.dot_op<{opIdx=1, parent=#mma0}> 3773 - module attributes {"triton_gpu.num-warps" = 1 : i32} { 3774 - // CHECK-LABEL: convert_dot 3775 - - func @convert_dot(%A: tensor<16x16xf16, #blocked0>, %B: tensor<16x16xf16, #blocked0>) { 3776 - + func.func @convert_dot(%A: tensor<16x16xf16, #blocked0>, %B: tensor<16x16xf16, #blocked0>) { 3777 - %AA = triton_gpu.convert_layout %A : (tensor<16x16xf16, #blocked0>) -> tensor<16x16xf16, #shared0> 3778 - %BB = triton_gpu.convert_layout %B : (tensor<16x16xf16, #blocked0>) -> tensor<16x16xf16, #shared0> 3779 - // CHECK: llvm.inline_asm 3780 - @@ -775,7 +775,7 @@ module attributes {"triton_gpu.num-warps" = 1 : i32} { 3781 - // TODO: problems in MLIR's parser on slice layout 3782 - // #blocked0 = #triton_gpu.blocked<{sizePerThread = [1, 4], threadsPerWarp = [8, 4], warpsPerCTA = [1, 1], order = [1, 0]}> 3783 - // module attributes {"triton_gpu.num-warps" = 1 : i32} { 3784 - -// func @make_range_sliced_layout() { 3785 - +// func.func @make_range_sliced_layout() { 3786 - // %0 = tt.make_range {end = 16 : i32, start = 0 : i32} : tensor<16xi32, #triton_gpu.slice<{dim = 0, parent = #blocked0}>> 3787 - // return 3788 - // } 3789 - @@ -788,7 +788,7 @@ module attributes {"triton_gpu.num-warps" = 1 : i32} { 3790 - module attributes {"triton_gpu.num-warps" = 1 : i32} { 3791 - // CHECK: llvm.mlir.global external @global_smem() {addr_space = 3 : i32} : !llvm.array<0 x i8> 3792 - // CHECK-LABEL: convert_layout_mmav2_block 3793 - - func @convert_layout_mmav2_blocked(%arg0: tensor<32x16xf32, #mma>) { 3794 - + func.func @convert_layout_mmav2_blocked(%arg0: tensor<32x16xf32, #mma>) { 3795 - // CHECK: llvm.store 3796 - // CHECK-SAME: !llvm.ptr<vector<2xf32>, 3> 3797 - // CHECK: llvm.store 3798 - @@ -808,7 +808,7 @@ module attributes {"triton_gpu.num-warps" = 1 : i32} { 3799 - module attributes {"triton_gpu.num-warps" = 1 : i32} { 3800 - // CHECK: llvm.mlir.global external @global_smem() {addr_space = 3 : i32} : !llvm.array<0 x i8> 3801 - // CHECK-LABEL: convert_layout_mmav1_block 3802 - - func @convert_layout_mmav1_blocked(%arg0: tensor<32x64xf32, #mma>) { 3803 - + func.func @convert_layout_mmav1_blocked(%arg0: tensor<32x64xf32, #mma>) { 3804 - // CHECK: llvm.store 3805 - // CHECK-SAME: !llvm.ptr<vector<2xf32>, 3> 3806 - // CHECK: llvm.store 3807 - @@ -831,7 +831,7 @@ module attributes {"triton_gpu.num-warps" = 1 : i32} { 3808 - module attributes {"triton_gpu.num-warps" = 1 : i32} { 3809 - // CHECK: llvm.mlir.global external @global_smem() {addr_space = 3 : i32} : !llvm.array<0 x i8> 3810 - // CHECK-LABEL: convert_layout_blocked_shared 3811 - - func @convert_layout_blocked_shared(%arg0: tensor<128x32xf32, #blocked0>) { 3812 - + func.func @convert_layout_blocked_shared(%arg0: tensor<128x32xf32, #blocked0>) { 3813 - // CHECK: llvm.store 3814 - // CHECK-SAME: !llvm.ptr<vector<8xf32>, 3> 3815 - // CHECK: llvm.store 3816 - @@ -847,7 +847,7 @@ module attributes {"triton_gpu.num-warps" = 1 : i32} { 3817 - #blocked1 = #triton_gpu.blocked<{sizePerThread = [1, 4], threadsPerWarp = [4, 8], warpsPerCTA = [1, 1], order = [1, 0]}> 3818 - module attributes {"triton_gpu.num-warps" = 1 : i32} { 3819 - // CHECK-LABEL: convert_blocked1d_to_slice0 3820 - - func @convert_blocked1d_to_slice0(%src:tensor<32xi32, #blocked0>) { 3821 - + func.func @convert_blocked1d_to_slice0(%src:tensor<32xi32, #blocked0>) { 3822 - // CHECK-COUNT-4: llvm.load {{.*}} : !llvm.ptr<vector<1xi32>, 3> 3823 - %cvt = triton_gpu.convert_layout %src : (tensor<32xi32, #blocked0>) -> tensor<32xi32, #triton_gpu.slice<{dim = 0, parent = #blocked1}>> 3824 - return 3825 - @@ -860,7 +860,7 @@ module attributes {"triton_gpu.num-warps" = 1 : i32} { 3826 - #blocked1 = #triton_gpu.blocked<{sizePerThread = [1, 4], threadsPerWarp = [4, 8], warpsPerCTA = [1, 1], order = [1, 0]}> 3827 - module attributes {"triton_gpu.num-warps" = 1 : i32} { 3828 - // CHECK-LABEL: convert_blocked1d_to_slice1 3829 - - func @convert_blocked1d_to_slice1(%src:tensor<32xi32, #blocked0>) { 3830 - + func.func @convert_blocked1d_to_slice1(%src:tensor<32xi32, #blocked0>) { 3831 - // CHECK-COUNT-32: llvm.load {{.*}} : !llvm.ptr<vector<1xi32>, 3> 3832 - %cvt = triton_gpu.convert_layout %src : (tensor<32xi32, #blocked0>) -> tensor<32xi32, #triton_gpu.slice<{dim = 1, parent = #blocked1}>> 3833 - return 3834 - @@ -873,7 +873,7 @@ module attributes {"triton_gpu.num-warps" = 1 : i32} { 3835 - #blocked1 = #triton_gpu.blocked<{sizePerThread = [4], threadsPerWarp = [32], warpsPerCTA = [1], order = [0]}> 3836 - module attributes {"triton_gpu.num-warps" = 1 : i32} { 3837 - // CHECK-LABEL: convert_blocked_to_blocked_ptr 3838 - - func @convert_blocked_to_blocked_ptr(%src:tensor<32x!tt.ptr<f32>, #blocked0>) { 3839 - + func.func @convert_blocked_to_blocked_ptr(%src:tensor<32x!tt.ptr<f32>, #blocked0>) { 3840 - // CHECK: llvm.ptrtoint 3841 - // CHECK: llvm.store 3842 - // CHECK: nvvm.barrier0 3843 - @@ -892,7 +892,7 @@ module attributes {"triton_gpu.num-warps" = 1 : i32} { 3844 - #dot_operand_a = #triton_gpu.dot_op<{opIdx=0, parent=#mma}> 3845 - #dot_operand_b = #triton_gpu.dot_op<{opIdx=1, parent=#mma}> 3846 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3847 - - func @matmul_kernel_dot_operand_layout(%ptr:!tt.ptr<f32> {tt.divisibility = 16 : i32}, 3848 - + func.func @matmul_kernel_dot_operand_layout(%ptr:!tt.ptr<f32> {tt.divisibility = 16 : i32}, 3849 - %a:tensor<128x32xf16, #shared>, %b:tensor<32x256xf16, #shared>) { 3850 - %cst = arith.constant dense<0.000000e+00> : tensor<128x256xf32, #mma> 3851 - // CHECK: ldmatrix.sync.aligned.m8n8.x4.shared.b16 3852 - @@ -918,7 +918,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3853 - #dot_operand_a = #triton_gpu.dot_op<{opIdx=0, parent=#mma, isMMAv1Row=true}> 3854 - #dot_operand_b = #triton_gpu.dot_op<{opIdx=1, parent=#mma, isMMAv1Row=true}> 3855 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3856 - - func @matmul884_kernel_dot_operand_layout(%ptr:!tt.ptr<f32> {tt.divisibility = 16 : i32}, 3857 - + func.func @matmul884_kernel_dot_operand_layout(%ptr:!tt.ptr<f32> {tt.divisibility = 16 : i32}, 3858 - %a:tensor<32x64xf16, #shared0>, %b:tensor<64x64xf16, #shared1>) { 3859 - %cst = arith.constant dense<0.000000e+00> : tensor<32x64xf32, #mma> 3860 - // CHECK: ldmatrix.sync.aligned.m8n8.x4.shared.b16 3861 - @@ -941,7 +941,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3862 - #dot_operand_a = #triton_gpu.dot_op<{opIdx=0, parent=#blocked}> 3863 - #dot_operand_b = #triton_gpu.dot_op<{opIdx=1, parent=#blocked}> 3864 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3865 - - func @matmul_fmadot(%ptr:!tt.ptr<f32> {tt.divisibility = 16 : i32}, 3866 - + func.func @matmul_fmadot(%ptr:!tt.ptr<f32> {tt.divisibility = 16 : i32}, 3867 - %a:tensor<32x16xf32, #shared>, %b:tensor<16x32xf32, #shared>) { 3868 - %cst = arith.constant dense<0.000000e+00> : tensor<32x32xf32, #blocked> 3869 - // CHECK: llvm.intr.fmuladd 3870 - @@ -965,7 +965,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3871 - #dot_operand_b = #triton_gpu.dot_op<{opIdx=1, parent=#mma}> 3872 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3873 - // CHECK-LABEL: matmul_tf32dot 3874 - - func @matmul_tf32dot(%ptr:!tt.ptr<f32> {tt.divisibility = 16 : i32}, 3875 - + func.func @matmul_tf32dot(%ptr:!tt.ptr<f32> {tt.divisibility = 16 : i32}, 3876 - %a:tensor<32x16xf32, #shared>, %b:tensor<16x32xf32, #shared>) { 3877 - %cst = arith.constant dense<0.000000e+00> : tensor<32x32xf32, #mma> 3878 - // CHECK: llvm.inline_asm 3879 - @@ -1000,7 +1000,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3880 - #blocked0 = #triton_gpu.blocked<{sizePerThread = [1], threadsPerWarp = [32], warpsPerCTA = [4], order = [0]}> 3881 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3882 - // CHECK-LABEL: atomic_add_f32 3883 - - func @atomic_add_f32(%arg0 : tensor<256x!tt.ptr<f32>, #blocked0>, %arg1 : tensor<256xi1, #blocked0>, %arg2 : tensor<256xf32, #blocked0>) { 3884 - + func.func @atomic_add_f32(%arg0 : tensor<256x!tt.ptr<f32>, #blocked0>, %arg1 : tensor<256xi1, #blocked0>, %arg2 : tensor<256xf32, #blocked0>) { 3885 - // CHECK: llvm.inline_asm 3886 - // CHECK-SAME: atom.global.gpu.add.f32 3887 - %0 = "tt.atomic_rmw" (%arg0, %arg2, %arg1) {atomic_rmw_op = 5 : i32} : (tensor<256x!tt.ptr<f32>, #blocked0>, tensor<256xf32, #blocked0>, tensor<256xi1, #blocked0>) -> tensor<256xf32, #blocked0> 3888 - @@ -1012,7 +1012,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3889 - #blocked0 = #triton_gpu.blocked<{sizePerThread = [1], threadsPerWarp = [32], warpsPerCTA = [4], order = [0]}> 3890 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3891 - 3892 - -func @test_get_program_id(%a: tensor<32x!tt.ptr<i32>, #blocked0>) { 3893 - +func.func @test_get_program_id(%a: tensor<32x!tt.ptr<i32>, #blocked0>) { 3894 - %blockidx = tt.get_program_id {axis=0:i32} : i32 3895 - %blockidy = tt.get_program_id {axis=1:i32} : i32 3896 - %blockidz = tt.get_program_id {axis=2:i32} : i32 3897 - @@ -1032,7 +1032,7 @@ func @test_get_program_id(%a: tensor<32x!tt.ptr<i32>, #blocked0>) { 3898 - // ----- 3899 - #blocked0 = #triton_gpu.blocked<{sizePerThread = [1], threadsPerWarp = [32], warpsPerCTA = [4], order = [0]}> 3900 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3901 - - func @test_get_num_program(%a: tensor<32x!tt.ptr<i32>, #blocked0>) { 3902 - + func.func @test_get_num_program(%a: tensor<32x!tt.ptr<i32>, #blocked0>) { 3903 - // CHECK: nvvm.read.ptx.sreg.nctaid.x 3904 - // CHECK: nvvm.read.ptx.sreg.nctaid.y 3905 - // CHECK: nvvm.read.ptx.sreg.nctaid.z 3906 - @@ -1052,7 +1052,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3907 - #blocked0 = #triton_gpu.blocked<{sizePerThread = [2], threadsPerWarp = [32], warpsPerCTA = [1], order = [0]}> 3908 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3909 - // CHECK-LABEL: test_index_cache 3910 - - func @test_index_cache() { 3911 - + func.func @test_index_cache() { 3912 - // CHECK: nvvm.read.ptx.sreg.tid.x 3913 - %0 = tt.make_range {end = 256 : i32, start = 0 : i32} : tensor<256xi32, #blocked0> 3914 - // CHECK-NOT: nvvm.read.ptx.sreg.tid.x 3915 - @@ -1066,7 +1066,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 3916 - #shared0 = #triton_gpu.shared<{vec = 8, perPhase = 2, maxPhase = 4, order = [1, 0]}> 3917 - module attributes {"triton_gpu.num-warps" = 1 : i32} { 3918 - // CHECK-LABEL: test_base_index_cache 3919 - - func @test_base_index_cache(%arg0: tensor<128x32xf32, #blocked0>) { 3920 - + func.func @test_base_index_cache(%arg0: tensor<128x32xf32, #blocked0>) { 3921 - // CHECK: nvvm.read.ptx.sreg.tid.x 3922 - %0 = triton_gpu.convert_layout %arg0 : (tensor<128x32xf32, #blocked0>) -> tensor<128x32xf32, #shared0> 3923 - // CHECK-NOT: nvvm.read.ptx.sreg.tid.x 3924 - @@ -1080,7 +1080,7 @@ module attributes {"triton_gpu.num-warps" = 1 : i32} { 3925 - #shared0 = #triton_gpu.shared<{vec = 8, perPhase = 2, maxPhase = 4, order = [1, 0]}> 3926 - module attributes {"triton_gpu.num-warps" = 1 : i32} { 3927 - // CHECK-LABEL: test_index_cache_different_block 3928 - - func @test_index_cache_different_block(%arg0: tensor<128x32xf32, #blocked0>, %arg1: i1) { 3929 - + func.func @test_index_cache_different_block(%arg0: tensor<128x32xf32, #blocked0>, %arg1: i1) { 3930 - // CHECK: nvvm.read.ptx.sreg.tid.x 3931 - %0 = triton_gpu.convert_layout %arg0 : (tensor<128x32xf32, #blocked0>) -> tensor<128x32xf32, #shared0> 3932 - scf.if %arg1 { 3933 - diff --git a/test/Target/tritongpu_to_llvmir.mlir b/test/Target/tritongpu_to_llvmir.mlir 3934 - index cafff3ca60..114d3a9eb2 100644 3935 - --- a/test/Target/tritongpu_to_llvmir.mlir 3936 - +++ b/test/Target/tritongpu_to_llvmir.mlir 3937 - @@ -4,11 +4,11 @@ 3938 - // CHECK-LABEL: ; ModuleID = 'LLVMDialectModule' 3939 - // CHECK: define void @test_empty_kernel 3940 - // CHECK: !nvvm.annotations 3941 - -// CHECK: !{void (i32, half addrspace(1)*)* @test_empty_kernel, !"maxntidx", i32 128} 3942 - +// CHECK: !{ptr @test_empty_kernel, !"maxntidx", i32 128} 3943 - 3944 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3945 - 3946 - -func @test_empty_kernel(%lb : index, %A : !tt.ptr<f16>) { 3947 - +func.func @test_empty_kernel(%lb : index, %A : !tt.ptr<f16>) { 3948 - 3949 - return 3950 - } 3951 - diff --git a/test/Target/tritongpu_to_ptx.mlir b/test/Target/tritongpu_to_ptx.mlir 3952 - index 404e970a29..12742ad9e2 100644 3953 - --- a/test/Target/tritongpu_to_ptx.mlir 3954 - +++ b/test/Target/tritongpu_to_ptx.mlir 3955 - @@ -6,7 +6,7 @@ 3956 - 3957 - module attributes {"triton_gpu.num-warps" = 4 : i32} { 3958 - 3959 - -func @test_empty_kernel(%lb : index, %A : !tt.ptr<f16>) { 3960 - +func.func @test_empty_kernel(%lb : index, %A : !tt.ptr<f16>) { 3961 - 3962 - return 3963 - } 3964 - diff --git a/test/Triton/combine.mlir b/test/Triton/combine.mlir 3965 - index 050a3f7565..5ef6790e69 100644 3966 - --- a/test/Triton/combine.mlir 3967 - +++ b/test/Triton/combine.mlir 3968 - @@ -2,10 +2,10 @@ 3969 - // RUN: triton-opt %s -split-input-file -canonicalize -triton-combine | FileCheck %s 3970 - 3971 - // CHECK-LABEL: @test_combine_dot_add_pattern 3972 - -func @test_combine_dot_add_pattern() -> (tensor<128x128xf32>, tensor<128x128xf32>) { 3973 - - // CHECK: %[[d:.*]] = arith.constant dense<3.000000e+00> : tensor<128x128xf32> 3974 - - // CHECK: %[[b:.*]] = arith.constant dense<2.000000e+00> : tensor<128x128xf32> 3975 - - // CHECK: %[[a:.*]] = arith.constant dense<1.000000e+00> : tensor<128x128xf32> 3976 - +func.func @test_combine_dot_add_pattern() -> (tensor<128x128xf32>, tensor<128x128xf32>) { 3977 - + // CHECK-DAG: %[[d:.*]] = arith.constant dense<3.000000e+00> : tensor<128x128xf32> 3978 - + // CHECK-DAG: %[[b:.*]] = arith.constant dense<2.000000e+00> : tensor<128x128xf32> 3979 - + // CHECK-DAG: %[[a:.*]] = arith.constant dense<1.000000e+00> : tensor<128x128xf32> 3980 - %a = arith.constant dense<1.0> : tensor<128x128xf32> 3981 - %b = arith.constant dense<2.0> : tensor<128x128xf32> 3982 - %zero = arith.constant dense<0.0> : tensor<128x128xf32> 3983 - @@ -24,7 +24,7 @@ func @test_combine_dot_add_pattern() -> (tensor<128x128xf32>, tensor<128x128xf32 3984 - 3985 - 3986 - // COM: CHECK-LABEL: @test_combine_addptr_pattern 3987 - -func @test_combine_addptr_pattern(%base: !tt.ptr<f32>) -> tensor<8x!tt.ptr<f32>> { 3988 - +func.func @test_combine_addptr_pattern(%base: !tt.ptr<f32>) -> tensor<8x!tt.ptr<f32>> { 3989 - %off0 = arith.constant 10 : i32 3990 - %off1 = arith.constant 15 : i32 3991 - 3992 - @@ -47,46 +47,46 @@ func @test_combine_addptr_pattern(%base: !tt.ptr<f32>) -> tensor<8x!tt.ptr<f32>> 3993 - 3994 - 3995 - // CHECK-LABEL: @test_combine_select_masked_load_pattern 3996 - -func @test_combine_select_masked_load_pattern(%ptr: tensor<8x!tt.ptr<f32>>, %cond: i1) -> (tensor<8xf32>, tensor<8xf32>) { 3997 - +func.func @test_combine_select_masked_load_pattern(%ptr: tensor<8x!tt.ptr<f32>>, %cond: i1) -> (tensor<8xf32>, tensor<8xf32>) { 3998 - %mask = tt.broadcast %cond : (i1) -> tensor<8xi1> 3999 - %false_val = arith.constant dense<0.0> : tensor<8xf32> 4000 - 4001 - // CHECK: %[[res1:.*]] = tt.load %{{.*}}, %{{.*}}, %{{.*}} {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : tensor<8xf32> 4002 - %x = tt.load %ptr, %mask, %false_val {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : tensor<8xf32> 4003 - - %0 = select %cond, %x, %false_val : tensor<8xf32> 4004 - + %0 = arith.select %cond, %x, %false_val : tensor<8xf32> 4005 - 4006 - // CHECK: %[[res2:.*]] = tt.load %{{.*}}, %{{.*}}, %{{.*}} {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : tensor<8xf32> 4007 - %y = tt.load %ptr, %mask, %false_val {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : tensor<8xf32> 4008 - - %1 = select %cond, %y, %false_val : tensor<8xf32> 4009 - + %1 = arith.select %cond, %y, %false_val : tensor<8xf32> 4010 - 4011 - // CHECK: return %[[res1]], %[[res2]] : tensor<8xf32>, tensor<8xf32> 4012 - return %0, %1 : tensor<8xf32>, tensor<8xf32> 4013 - } 4014 - 4015 - // CHECK-LABEL: @test_combine_select_masked_load_fail_pattern 4016 - -func @test_combine_select_masked_load_fail_pattern(%ptr: tensor<8x!tt.ptr<f32>>, %dummy_load: tensor<8xf32>, %dummy_broadcast: tensor<8xi1>, %cond0: i1, %cond1: i1) -> (tensor<8xf32>, tensor<8xf32>, tensor<8xf32>) { 4017 - +func.func @test_combine_select_masked_load_fail_pattern(%ptr: tensor<8x!tt.ptr<f32>>, %dummy_load: tensor<8xf32>, %dummy_broadcast: tensor<8xi1>, %cond0: i1, %cond1: i1) -> (tensor<8xf32>, tensor<8xf32>, tensor<8xf32>) { 4018 - %false_val = arith.constant dense<0.0> : tensor<8xf32> 4019 - 4020 - // Case 1: value at the "load" position is not an "op". Select should not be canonicalized. 4021 - - // CHECK: %{{.*}} = select %{{.*}}, %{{.*}}, %{{.*}} : tensor<8xf32> 4022 - - %0 = select %cond0, %dummy_load, %false_val : tensor<8xf32> 4023 - + // CHECK: %{{.*}} = arith.select %{{.*}}, %{{.*}}, %{{.*}} : tensor<8xf32> 4024 - + %0 = arith.select %cond0, %dummy_load, %false_val : tensor<8xf32> 4025 - 4026 - // Case 2: value at the "broadcast" position is not an "op". Select should not be canonicalized. 4027 - %real_load0 = tt.load %ptr, %dummy_broadcast, %false_val {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : tensor<8xf32> 4028 - - // CHECK: %{{.*}} = select %{{.*}}, %{{.*}}, %{{.*}} : tensor<8xf32> 4029 - - %1 = select %cond0, %real_load0, %false_val : tensor<8xf32> 4030 - + // CHECK: %{{.*}} = arith.select %{{.*}}, %{{.*}}, %{{.*}} : tensor<8xf32> 4031 - + %1 = arith.select %cond0, %real_load0, %false_val : tensor<8xf32> 4032 - 4033 - // Case 3: condition of "broadcast" is not the same as the condition of "select". Select should not be canonicalized. 4034 - %cond0_ = tt.broadcast %cond0 : (i1) -> tensor<8xi1> 4035 - %real_load1 = tt.load %ptr, %cond0_, %false_val {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : tensor<8xf32> 4036 - - // CHECK: %{{.*}} = select %{{.*}}, %{{.*}}, %{{.*}} : tensor<8xf32> 4037 - - %2 = select %cond1, %real_load1, %false_val : tensor<8xf32> 4038 - + // CHECK: %{{.*}} = arith.select %{{.*}}, %{{.*}}, %{{.*}} : tensor<8xf32> 4039 - + %2 = arith.select %cond1, %real_load1, %false_val : tensor<8xf32> 4040 - 4041 - return %0, %1, %2 : tensor<8xf32>, tensor<8xf32>, tensor<8xf32> 4042 - } 4043 - 4044 - // CHECK-LABEL: @test_combine_broadcast_constant_pattern 4045 - -func @test_combine_broadcast_constant_pattern(%cst : f32) -> tensor<8x2xf32> { 4046 - +func.func @test_combine_broadcast_constant_pattern(%cst : f32) -> tensor<8x2xf32> { 4047 - // CHECK: %[[cst:.*]] = arith.constant dense<1.000000e+00> : tensor<8x2xf32> 4048 - %const = arith.constant dense<1.0> : tensor<8xf32> 4049 - %bst_out = tt.broadcast %const : (tensor<8xf32>) -> tensor<8x2xf32> 4050 - @@ -96,7 +96,7 @@ func @test_combine_broadcast_constant_pattern(%cst : f32) -> tensor<8x2xf32> { 4051 - } 4052 - 4053 - // CHECK-LABEL: @test_canonicalize_masked_load_pattern 4054 - -func @test_canonicalize_masked_load_pattern(%ptr: tensor<8x!tt.ptr<f32>>) -> (tensor<8xf32>, tensor<8xf32>, tensor<8xf32>) { 4055 - +func.func @test_canonicalize_masked_load_pattern(%ptr: tensor<8x!tt.ptr<f32>>) -> (tensor<8xf32>, tensor<8xf32>, tensor<8xf32>) { 4056 - %true_mask = arith.constant dense<true> : tensor<8xi1> 4057 - %false_mask = arith.constant dense<false> : tensor<8xi1> 4058 - %other_val = arith.constant dense<0.0> : tensor<8xf32> 4059 - @@ -117,7 +117,7 @@ func @test_canonicalize_masked_load_pattern(%ptr: tensor<8x!tt.ptr<f32>>) -> (te 4060 - } 4061 - 4062 - // CHECK-LABEL: @test_canonicalize_masked_load_fail_pattern 4063 - -func @test_canonicalize_masked_load_fail_pattern(%ptr: tensor<8x!tt.ptr<f32>>, %mask: tensor<8xi1>) -> (tensor<8xf32>, tensor<8xf32>) { 4064 - +func.func @test_canonicalize_masked_load_fail_pattern(%ptr: tensor<8x!tt.ptr<f32>>, %mask: tensor<8xi1>) -> (tensor<8xf32>, tensor<8xf32>) { 4065 - %other_val = arith.constant dense<0.0> : tensor<8xf32> 4066 - 4067 - // Case: value at the "mask" position is not an "op". Load should not be canonicalized. 4068 - @@ -130,7 +130,7 @@ func @test_canonicalize_masked_load_fail_pattern(%ptr: tensor<8x!tt.ptr<f32>>, % 4069 - } 4070 - 4071 - // CHECK-LABEL: @test_canonicalize_masked_store_pattern 4072 - -func @test_canonicalize_masked_store_pattern(%ptr: tensor<8x!tt.ptr<f32>>, %val: tensor<8xf32>) { 4073 - +func.func @test_canonicalize_masked_store_pattern(%ptr: tensor<8x!tt.ptr<f32>>, %val: tensor<8xf32>) { 4074 - %true_mask = arith.constant dense<true> : tensor<8xi1> 4075 - %false_mask = arith.constant dense<false> : tensor<8xi1> 4076 - 4077 - @@ -144,7 +144,7 @@ func @test_canonicalize_masked_store_pattern(%ptr: tensor<8x!tt.ptr<f32>>, %val: 4078 - } 4079 - 4080 - // CHECK-LABEL: @test_canonicalize_masked_store_fail_pattern 4081 - -func @test_canonicalize_masked_store_fail_pattern(%ptr: tensor<8x!tt.ptr<f32>>, %val: tensor<8xf32>, %mask: tensor<8xi1>) { 4082 - +func.func @test_canonicalize_masked_store_fail_pattern(%ptr: tensor<8x!tt.ptr<f32>>, %val: tensor<8xf32>, %mask: tensor<8xi1>) { 4083 - // Case: value at the "mask" position is not an "op". Store should not be canonicalized. 4084 - // CHECK: tt.store %{{.*}}, %{{.*}}, %{{.*}} : tensor<8xf32> 4085 - tt.store %ptr, %val, %mask : tensor<8xf32> 4086 - diff --git a/test/Triton/vecadd.mlir b/test/Triton/vecadd.mlir 4087 - index 0b69ef3054..f5019b1cdd 100644 4088 - --- a/test/Triton/vecadd.mlir 4089 - +++ b/test/Triton/vecadd.mlir 4090 - @@ -1,7 +1,7 @@ 4091 - // RUN: triton-opt %s -verify-diagnostics 4092 - 4093 - module { 4094 - - func @add_kernel__Pfp32_Pfp32_Pfp32_i32_i32_i32__(%arg0: !tt.ptr<f32>, %arg1: !tt.ptr<f32>, %arg2: !tt.ptr<f32>, %arg3: i32, %arg4: i32, %arg5: i32) { 4095 - + func.func @add_kernel__Pfp32_Pfp32_Pfp32_i32_i32_i32__(%arg0: !tt.ptr<f32>, %arg1: !tt.ptr<f32>, %arg2: !tt.ptr<f32>, %arg3: i32, %arg4: i32, %arg5: i32) { 4096 - %0 = tt.get_program_id {axis = 0 : i32} : i32 4097 - %c256_i32 = arith.constant 256 : i32 4098 - %1 = arith.muli %0, %c256_i32 : i32 4099 - @@ -43,7 +43,7 @@ module { 4100 - } 4101 - } 4102 - // module { 4103 - -// func @add_kernel__Pfp32_Pfp32_Pfp32_i32_i32_i32__(%arg0: !tt.ptr<f32>, %arg1: !tt.ptr<f32>, %arg2: !tt.ptr<f32>, %arg3: i32, %arg4: i32, %arg5: i32) { 4104 - +// func.func @add_kernel__Pfp32_Pfp32_Pfp32_i32_i32_i32__(%arg0: !tt.ptr<f32>, %arg1: !tt.ptr<f32>, %arg2: !tt.ptr<f32>, %arg3: i32, %arg4: i32, %arg5: i32) { 4105 - // %c64 = arith.constant 64 : index 4106 - // %c32 = arith.constant 32 : index 4107 - // %c0 = arith.constant 0 : index 4108 - diff --git a/test/TritonGPU/coalesce.mlir b/test/TritonGPU/coalesce.mlir 4109 - index 60e359f527..51cccccfbd 100644 4110 - --- a/test/TritonGPU/coalesce.mlir 4111 - +++ b/test/TritonGPU/coalesce.mlir 4112 - @@ -19,7 +19,7 @@ module attributes {"triton_gpu.num-warps" = 4 : i32} { 4113 - // CHECK: [[store_val:%.*]] = triton_gpu.convert_layout {{.*}} -> tensor<64x64xf32, [[col_layout]]> 4114 - // CHECK: [[store_mask:%.*]] = triton_gpu.convert_layout {{.*}} -> tensor<64x64xi1, [[col_layout]]> 4115 - // CHECK: tt.store [[store_ptr]], [[store_val]], [[store_mask]] 4116 - -func @transpose(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, 4117 - +func.func @transpose(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, 4118 - %arg1: i32 {tt.divisibility = 16 : i32}, 4119 - %arg2: !tt.ptr<f32> {tt.divisibility = 16 : i32}, 4120 - %arg3: i32 {tt.divisibility = 16 : i32}) { 4121 - diff --git a/test/TritonGPU/combine.mlir b/test/TritonGPU/combine.mlir 4122 - index 2c009ffa48..7e9cb9d504 100644 4123 - --- a/test/TritonGPU/combine.mlir 4124 - +++ b/test/TritonGPU/combine.mlir 4125 - @@ -9,7 +9,7 @@ 4126 - // CHECK: [[col_layout:#.*]] = #triton_gpu.blocked<{sizePerThread = [4, 1], threadsPerWarp = [16, 2], warpsPerCTA = [4, 1], order = [0, 1]}> 4127 - // CHECK: [[col_layout_novec:#.*]] = #triton_gpu.blocked<{sizePerThread = [1, 1], threadsPerWarp = [32, 1], warpsPerCTA = [4, 1], order = [0, 1]}> 4128 - // CHECK-LABEL: cst 4129 - -func @cst() -> tensor<1024xi32, #layout1> { 4130 - +func.func @cst() -> tensor<1024xi32, #layout1> { 4131 - %cst = arith.constant dense<0> : tensor<1024xi32, #layout0> 4132 - %1 = triton_gpu.convert_layout %cst : (tensor<1024xi32, #layout0>) -> tensor<1024xi32, #layout1> 4133 - // CHECK-NOT: triton_gpu.convert_layout 4134 - @@ -18,7 +18,7 @@ func @cst() -> tensor<1024xi32, #layout1> { 4135 - } 4136 - 4137 - // CHECK-LABEL: range 4138 - -func @range() -> tensor<1024xi32, #layout1> { 4139 - +func.func @range() -> tensor<1024xi32, #layout1> { 4140 - %0 = tt.make_range {end = 1024 : i32, start = 0 : i32} : tensor<1024xi32, #layout0> 4141 - %1 = triton_gpu.convert_layout %0 : (tensor<1024xi32, #layout0>) -> tensor<1024xi32, #layout1> 4142 - // CHECK-NOT: triton_gpu.convert_layout 4143 - @@ -27,7 +27,7 @@ func @range() -> tensor<1024xi32, #layout1> { 4144 - } 4145 - 4146 - // CHECK-LABEL: splat 4147 - -func @splat(%arg0: i32) -> tensor<1024xi32, #layout1> { 4148 - +func.func @splat(%arg0: i32) -> tensor<1024xi32, #layout1> { 4149 - %0 = tt.splat %arg0 : (i32) -> tensor<1024xi32, #layout0> 4150 - %1 = triton_gpu.convert_layout %0 : (tensor<1024xi32, #layout0>) -> tensor<1024xi32, #layout1> 4151 - // CHECK-NOT: triton_gpu.convert_layout 4152 - @@ -36,7 +36,7 @@ func @splat(%arg0: i32) -> tensor<1024xi32, #layout1> { 4153 - } 4154 - 4155 - // CHECK-LABEL: remat 4156 - -func @remat(%arg0: i32) -> tensor<1024xi32, #layout1> { 4157 - +func.func @remat(%arg0: i32) -> tensor<1024xi32, #layout1> { 4158 - %0 = tt.make_range {end = 1024 : i32, start = 0 : i32} : tensor<1024xi32, #layout0> 4159 - %1 = tt.make_range {end = 1024 : i32, start = 0 : i32} : tensor<1024xi32, #layout0> 4160 - %2 = arith.muli %0, %1 : tensor<1024xi32, #layout0> 4161 - @@ -56,7 +56,7 @@ func @remat(%arg0: i32) -> tensor<1024xi32, #layout1> { 4162 - } 4163 - 4164 - // CHECK-LABEL: remat_load_store 4165 - -func @remat_load_store(%arg: !tt.ptr<i32> {tt.divisibility = 16 : i32}) { 4166 - +func.func @remat_load_store(%arg: !tt.ptr<i32> {tt.divisibility = 16 : i32}) { 4167 - %0 = tt.make_range {end = 64 : i32, start = 0 : i32} : tensor<64xi32, #layout0> 4168 - %1 = tt.splat %arg : (!tt.ptr<i32>) -> tensor<64x!tt.ptr<i32>, #layout0> 4169 - %2 = tt.addptr %1, %0 : tensor<64x!tt.ptr<i32>, #layout0>, tensor<64xi32, #layout0> 4170 - @@ -70,7 +70,7 @@ func @remat_load_store(%arg: !tt.ptr<i32> {tt.divisibility = 16 : i32}) { 4171 - 4172 - // Don't rematerialize vectorized loads 4173 - // CHECK-LABEL: remat_expensive 4174 - -func @remat_expensive(%arg: !tt.ptr<i32> {tt.divisibility = 16 : i32}) { 4175 - +func.func @remat_expensive(%arg: !tt.ptr<i32> {tt.divisibility = 16 : i32}) { 4176 - %0 = tt.make_range {end = 64 : i32, start = 0 : i32} : tensor<64xi32, #layout1> 4177 - %1 = tt.splat %arg : (!tt.ptr<i32>) -> tensor<64x!tt.ptr<i32>, #layout1> 4178 - %2 = tt.addptr %1, %0 : tensor<64x!tt.ptr<i32>, #layout1>, tensor<64xi32, #layout1> 4179 - @@ -85,7 +85,7 @@ func @remat_expensive(%arg: !tt.ptr<i32> {tt.divisibility = 16 : i32}) { 4180 - 4181 - // Don't rematerialize loads when original and target layouts are different 4182 - // CHECK-LABEL: remat_multi_layout 4183 - -func @remat_multi_layout(%arg: !tt.ptr<i32> {tt.divisibility = 16 : i32}) { 4184 - +func.func @remat_multi_layout(%arg: !tt.ptr<i32> {tt.divisibility = 16 : i32}) { 4185 - %0 = tt.make_range {end = 64 : i32, start = 0 : i32} : tensor<64xi32, #layout0> 4186 - %1 = tt.splat %arg : (!tt.ptr<i32>) -> tensor<64x!tt.ptr<i32>, #layout0> 4187 - %2 = tt.addptr %1, %0 : tensor<64x!tt.ptr<i32>, #layout0>, tensor<64xi32, #layout0> 4188 - @@ -100,7 +100,7 @@ func @remat_multi_layout(%arg: !tt.ptr<i32> {tt.divisibility = 16 : i32}) { 4189 - 4190 - // Always rematerialize single value loads 4191 - // CHECK-LABEL: remat_single_value 4192 - -func @remat_single_value(%arg: !tt.ptr<i32> {tt.divisibility = 16 : i32}) { 4193 - +func.func @remat_single_value(%arg: !tt.ptr<i32> {tt.divisibility = 16 : i32}) { 4194 - %0 = tt.splat %arg : (!tt.ptr<i32>) -> tensor<1x!tt.ptr<i32>, #layout1> 4195 - %1 = tt.load %0 {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : tensor<1xi32, #layout1> 4196 - // CHECK-NOT: triton_gpu.convert_layout 4197 - @@ -111,7 +111,7 @@ func @remat_single_value(%arg: !tt.ptr<i32> {tt.divisibility = 16 : i32}) { 4198 - } 4199 - 4200 - // CHECK-LABEL: if 4201 - -func @if(%arg0: i32, %arg1: !tt.ptr<i32> {tt.divisibility = 16 : i32}) { 4202 - +func.func @if(%arg0: i32, %arg1: !tt.ptr<i32> {tt.divisibility = 16 : i32}) { 4203 - // CHECK-NOT: triton_gpu.convert_layout 4204 - %c32_i32 = arith.constant dense<32> : tensor<1024xi32, #layout1> 4205 - %0 = tt.get_program_id {axis = 0 : i32} : i32 4206 - @@ -128,7 +128,7 @@ func @if(%arg0: i32, %arg1: !tt.ptr<i32> {tt.divisibility = 16 : i32}) { 4207 - } 4208 - 4209 - // CHECK-LABEL: if_convert_else_not 4210 - -func @if_convert_else_not(%arg0: i32, %arg1: !tt.ptr<i32> {tt.divisibility = 16 : i32}) { 4211 - +func.func @if_convert_else_not(%arg0: i32, %arg1: !tt.ptr<i32> {tt.divisibility = 16 : i32}) { 4212 - %c32_i32 = arith.constant dense<32> : tensor<1024xi32, #layout0> 4213 - %0 = tt.get_program_id {axis = 0 : i32} : i32 4214 - %1 = tt.splat %0 : (i32) -> tensor<1024xi32, #layout0> 4215 - @@ -149,7 +149,7 @@ func @if_convert_else_not(%arg0: i32, %arg1: !tt.ptr<i32> {tt.divisibility = 16 4216 - } 4217 - 4218 - // CHECK-LABEL: if_not_else_convert 4219 - -func @if_not_else_convert(%arg0: i32, %arg1: !tt.ptr<i32> {tt.divisibility = 16 : i32}) { 4220 - +func.func @if_not_else_convert(%arg0: i32, %arg1: !tt.ptr<i32> {tt.divisibility = 16 : i32}) { 4221 - %c32_i32 = arith.constant dense<32> : tensor<1024xi32, #layout0> 4222 - %0 = tt.get_program_id {axis = 0 : i32} : i32 4223 - %1 = tt.splat %0 : (i32) -> tensor<1024xi32, #layout0> 4224 - @@ -170,7 +170,7 @@ func @if_not_else_convert(%arg0: i32, %arg1: !tt.ptr<i32> {tt.divisibility = 16 4225 - } 4226 - 4227 - // CHECK-LABEL: if_else_both_convert 4228 - -func @if_else_both_convert(%arg0: i32, %arg1: !tt.ptr<i32> {tt.divisibility = 16 : i32}) { 4229 - +func.func @if_else_both_convert(%arg0: i32, %arg1: !tt.ptr<i32> {tt.divisibility = 16 : i32}) { 4230 - %c32_i32 = arith.constant dense<32> : tensor<1024xi32, #layout0> 4231 - %0 = tt.get_program_id {axis = 0 : i32} : i32 4232 - %1 = tt.splat %0 : (i32) -> tensor<1024xi32, #layout0> 4233 - @@ -200,7 +200,7 @@ func @if_else_both_convert(%arg0: i32, %arg1: !tt.ptr<i32> {tt.divisibility = 16 4234 - #blocked4 = #triton_gpu.blocked<{sizePerThread = [4, 1], threadsPerWarp = [16, 2], warpsPerCTA = [4, 1], order = [0, 1]}> 4235 - 4236 - // CHECK-LABEL: transpose 4237 - -func @transpose(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg1: i32 {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg3: i32 {tt.divisibility = 16 : i32}) { 4238 - +func.func @transpose(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg1: i32 {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg3: i32 {tt.divisibility = 16 : i32}) { 4239 - // CHECK-NOT: triton_gpu.convert_layout 4240 - // CHECK: [[loaded_val:%.*]] = tt.load {{.*}}, {{%cst.*}}, {{%cst.*}} {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : tensor<64x64xf32, [[row_layout]]> 4241 - // CHECK: [[cvt_val:%.*]] = triton_gpu.convert_layout [[loaded_val]] : (tensor<64x64xf32, [[row_layout]]>) -> tensor<64x64xf32, [[col_layout]]> 4242 - @@ -241,7 +241,7 @@ func @transpose(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg1: i32 {tt 4243 - } 4244 - 4245 - // CHECK-LABEL: loop 4246 - -func @loop(%arg0: !tt.ptr<f32>, %arg1: i32, %arg2: !tt.ptr<f32>, %arg3: i32, %arg4: i32) { 4247 - +func.func @loop(%arg0: !tt.ptr<f32>, %arg1: i32, %arg2: !tt.ptr<f32>, %arg3: i32, %arg4: i32) { 4248 - // CHECK-NOT: triton_gpu.convert_layout 4249 - // CHECK: [[loop_ret:%.*]]:2 = scf.for {{.*}} -> (tensor<64x64xf32, [[row_layout]]>, tensor<64x64x!tt.ptr<f32>, [[row_layout]]>) 4250 - // CHECK-NEXT: {{.*}} = tt.load {{.*}} : tensor<64x64xf32, [[row_layout]]> 4251 - @@ -295,7 +295,7 @@ func @loop(%arg0: !tt.ptr<f32>, %arg1: i32, %arg2: !tt.ptr<f32>, %arg3: i32, %ar 4252 - } 4253 - 4254 - // CHECK-LABEL: vecadd 4255 - -func @vecadd(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg3: i32) { 4256 - +func.func @vecadd(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg3: i32) { 4257 - // CHECK-NOT: triton_gpu.convert_layout 4258 - %c256_i32 = arith.constant 256 : i32 4259 - %0 = tt.get_program_id {axis = 0 : i32} : i32 4260 - @@ -327,7 +327,7 @@ func @vecadd(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f3 4261 - 4262 - // Select has args with different element types 4263 - // CHECK-LABEL: select 4264 - -func @select(%arg0: !tt.ptr<f64> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f64> {tt.divisibility = 16 : i32}, %arg2: i32 {tt.divisibility = 16 : i32}) { 4265 - +func.func @select(%arg0: !tt.ptr<f64> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f64> {tt.divisibility = 16 : i32}, %arg2: i32 {tt.divisibility = 16 : i32}) { 4266 - // CHECK-NOT: triton_gpu.convert_layout 4267 - %cst = arith.constant dense<30000> : tensor<1x1xi32, #blocked2> 4268 - %cst_0 = arith.constant dense<30000> : tensor<1x512xi32, #blocked2> 4269 - @@ -378,7 +378,7 @@ func @select(%arg0: !tt.ptr<f64> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f6 4270 - 4271 - // Make sure the following IR doesn't hang the compiler. 4272 - // CHECK-LABEL: long_func 4273 - -func public @long_func(%arg0: !tt.ptr<i64> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<i64> {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<i64> {tt.divisibility = 16 : i32}, %arg3: !tt.ptr<i64> {tt.divisibility = 16 : i32}, %arg4: !tt.ptr<i64> {tt.divisibility = 16 : i32}, %arg5: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg6: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg7: !tt.ptr<i64> {tt.divisibility = 16 : i32}, %arg8: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg9: !tt.ptr<f64> {tt.divisibility = 16 : i32}, %arg10: !tt.ptr<f64> {tt.divisibility = 16 : i32}, %arg11: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg12: !tt.ptr<i32> {tt.divisibility = 16 : i32}, %arg13: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg14: !tt.ptr<f64> {tt.divisibility = 16 : i32}, %arg15: !tt.ptr<f64> {tt.divisibility = 16 : i32}, %arg16: i32 {tt.divisibility = 16 : i32}) { 4274 - +func.func public @long_func(%arg0: !tt.ptr<i64> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<i64> {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<i64> {tt.divisibility = 16 : i32}, %arg3: !tt.ptr<i64> {tt.divisibility = 16 : i32}, %arg4: !tt.ptr<i64> {tt.divisibility = 16 : i32}, %arg5: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg6: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg7: !tt.ptr<i64> {tt.divisibility = 16 : i32}, %arg8: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg9: !tt.ptr<f64> {tt.divisibility = 16 : i32}, %arg10: !tt.ptr<f64> {tt.divisibility = 16 : i32}, %arg11: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg12: !tt.ptr<i32> {tt.divisibility = 16 : i32}, %arg13: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg14: !tt.ptr<f64> {tt.divisibility = 16 : i32}, %arg15: !tt.ptr<f64> {tt.divisibility = 16 : i32}, %arg16: i32 {tt.divisibility = 16 : i32}) { 4275 - %cst = arith.constant dense<1.000000e+00> : tensor<1024xf32, #blocked0> 4276 - %cst_0 = arith.constant dense<5.000000e-04> : tensor<1024xf32, #blocked0> 4277 - %cst_1 = arith.constant dense<0.999499976> : tensor<1024xf32, #blocked0> 4278 - @@ -775,7 +775,7 @@ func public @long_func(%arg0: !tt.ptr<i64> {tt.divisibility = 16 : i32}, %arg1: 4279 - // A mnist model from torch inductor. 4280 - // Check if topological sort is working correct and there's no unnecessary convert 4281 - // CHECK-LABEL: mnist 4282 - -func public @mnist(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg2: i32 {tt.divisibility = 16 : i32}, %arg3: i32) { 4283 - +func.func public @mnist(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg2: i32 {tt.divisibility = 16 : i32}, %arg3: i32) { 4284 - // CHECK-NOT: triton_gpu.convert_layout 4285 - %cst = arith.constant dense<10> : tensor<16x1xi32, #blocked2> 4286 - %cst_0 = arith.constant dense<10> : tensor<1x16xi32, #blocked3> 4287 - @@ -862,7 +862,7 @@ func public @mnist(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg1: !tt. 4288 - #blocked5 = #triton_gpu.blocked<{sizePerThread = [1, 4], threadsPerWarp = [2, 16], warpsPerCTA = [8, 1], order = [1, 0]}> 4289 - // cmpf and cmpi have different operands and result types 4290 - // CHECK-LABEL: cmp 4291 - -func public @cmp(%arg0: !tt.ptr<f16> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg3: !tt.ptr<f16> {tt.divisibility = 16 : i32}, %arg4: i32 {tt.divisibility = 16 : i32}, %arg5: i32 {tt.divisibility = 16 : i32}) { 4292 - +func.func public @cmp(%arg0: !tt.ptr<f16> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg3: !tt.ptr<f16> {tt.divisibility = 16 : i32}, %arg4: i32 {tt.divisibility = 16 : i32}, %arg5: i32 {tt.divisibility = 16 : i32}) { 4293 - %c64 = arith.constant 64 : index 4294 - %c2048 = arith.constant 2048 : index 4295 - %c0 = arith.constant 0 : index 4296 - diff --git a/test/TritonGPU/loop-pipeline.mlir b/test/TritonGPU/loop-pipeline.mlir 4297 - index 6ee3b15fbc..663f2da7b0 100644 4298 - --- a/test/TritonGPU/loop-pipeline.mlir 4299 - +++ b/test/TritonGPU/loop-pipeline.mlir 4300 - @@ -10,7 +10,7 @@ 4301 - #A = #triton_gpu.dot_op<{opIdx = 0, parent = #C}> 4302 - #B = #triton_gpu.dot_op<{opIdx = 1, parent = #C}> 4303 - 4304 - -// CHECK: func @matmul_loop 4305 - +// CHECK: func.func @matmul_loop 4306 - // CHECK-DAG: %[[CONSTANT_0:.*]] = arith.constant 0 : i32 4307 - // CHECK-DAG: %[[CONSTANT_1:.*]] = arith.constant 1 : i32 4308 - // CHECK-DAG: %[[CONSTANT_2:.*]] = arith.constant 2 : i32 4309 - @@ -46,8 +46,8 @@ 4310 - // CHECK-DAG: %[[NEXT_PIPELINE_IDX:.*]] = arith.addi %[[PIPELINE_IDX]], %[[CONSTANT_1]] 4311 - // CHECK-DAG: %[[NEXT_LOOP_IDX:.*]] = arith.addi %[[LOOP_IDX]], %[[CONSTANT_1]] 4312 - // CHECK: scf.yield {{.*}}, {{.*}}, {{.*}}, %[[NEXT_A_BUFFER]], %[[NEXT_B_BUFFER]], %[[NEXT_A]], %[[NEXT_B]], {{.*}}, {{.*}}, {{.*}}, %[[NEXT_PIPELINE_IDX]], %[[NEXT_LOOP_IDX]] 4313 - -func @matmul_loop(%lb : index, %ub : index, %step : index, 4314 - - %A : !tt.ptr<f16> {tt.divisibility = 16 : i32}, 4315 - +func.func @matmul_loop(%lb : index, %ub : index, %step : index, 4316 - + %A : !tt.ptr<f16> {tt.divisibility = 16 : i32}, 4317 - %B : !tt.ptr<f16> {tt.divisibility = 16 : i32}) { 4318 - // A ptrs 4319 - %a_ptr_splat = tt.splat %A : (!tt.ptr<f16>) -> tensor<128x32x!tt.ptr<f16>, #AL> 4320 - @@ -61,7 +61,7 @@ func @matmul_loop(%lb : index, %ub : index, %step : index, 4321 - %b_tmp1 = tt.expand_dims %b_tmp0 {axis = 0 : i32} : (tensor<128xi32, #BLs0>) -> tensor<1x128xi32, #BL> 4322 - %b_offs = tt.broadcast %b_tmp1 : (tensor<1x128xi32, #BL>) -> tensor<32x128xi32, #BL> 4323 - %b_ptr_init = tt.addptr %b_ptr_splat, %b_offs : tensor<32x128x!tt.ptr<f16>, #BL>, tensor<32x128xi32, #BL> 4324 - - 4325 - + 4326 - 4327 - %a_mask = arith.constant dense<true> : tensor<128x32xi1, #AL> 4328 - %a_other = arith.constant dense<0.00e+00> : tensor<128x32xf16, #AL> 4329 - @@ -88,7 +88,7 @@ func @matmul_loop(%lb : index, %ub : index, %step : index, 4330 - } 4331 - 4332 - 4333 - -// CHECK: func @matmul_loop_nested 4334 - +// CHECK: func.func @matmul_loop_nested 4335 - // CHECK-DAG: %[[CONSTANT_0:.*]] = arith.constant 0 : i32 4336 - // CHECK-DAG: %[[CONSTANT_1:.*]] = arith.constant 1 : i32 4337 - // CHECK-DAG: %[[CONSTANT_2:.*]] = arith.constant 2 : i32 4338 - @@ -118,8 +118,8 @@ func @matmul_loop(%lb : index, %ub : index, %step : index, 4339 - // CHECK-DAG: %[[NEXT_PIPELINE_IDX:.*]] = arith.addi %[[PIPELINE_IDX]], %[[CONSTANT_1]] 4340 - // CHECK-DAG: %[[NEXT_LOOP_IDX:.*]] = arith.addi %[[LOOP_IDX]], %[[CONSTANT_1]] 4341 - // CHECK: scf.yield {{.*}}, {{.*}}, {{.*}}, %[[NEXT_A_BUFFER]], %[[NEXT_B_BUFFER]], %[[NEXT_A]], %[[NEXT_B]], {{.*}}, {{.*}}, {{.*}}, %[[NEXT_PIPELINE_IDX]], %[[NEXT_LOOP_IDX]] 4342 - -func @matmul_loop_nested(%lb : index, %ub : index, %step : index, 4343 - - %A : !tt.ptr<f16> {tt.divisibility = 16 : i32}, 4344 - +func.func @matmul_loop_nested(%lb : index, %ub : index, %step : index, 4345 - + %A : !tt.ptr<f16> {tt.divisibility = 16 : i32}, 4346 - %B : !tt.ptr<f16> {tt.divisibility = 16 : i32}) { 4347 - scf.for %iv0 = %lb to %ub step %step { 4348 - // A ptrs 4349 - @@ -134,7 +134,7 @@ func @matmul_loop_nested(%lb : index, %ub : index, %step : index, 4350 - %b_tmp1 = tt.expand_dims %b_tmp0 {axis = 0 : i32} : (tensor<128xi32, #BLs0>) -> tensor<1x128xi32, #BL> 4351 - %b_offs = tt.broadcast %b_tmp1 : (tensor<1x128xi32, #BL>) -> tensor<32x128xi32, #BL> 4352 - %b_ptr_init = tt.addptr %b_ptr_splat, %b_offs : tensor<32x128x!tt.ptr<f16>, #BL>, tensor<32x128xi32, #BL> 4353 - - 4354 - + 4355 - %a_mask = arith.constant dense<true> : tensor<128x32xi1, #AL> 4356 - %a_other = arith.constant dense<0.00e+00> : tensor<128x32xf16, #AL> 4357 - %b_mask = arith.constant dense<true> : tensor<32x128xi1, #BL> 4358 - @@ -161,7 +161,7 @@ func @matmul_loop_nested(%lb : index, %ub : index, %step : index, 4359 - } 4360 - 4361 - 4362 - -// CHECK: func @matmul_loop_single_pipeline 4363 - +// CHECK: func.func @matmul_loop_single_pipeline 4364 - // CHECK-DAG: %[[CONSTANT_0:.*]] = arith.constant 0 : i32 4365 - // CHECK-DAG: %[[CONSTANT_1:.*]] = arith.constant 1 : i32 4366 - // CHECK-DAG: %[[CONSTANT_2:.*]] = arith.constant 2 : i32 4367 - @@ -183,8 +183,8 @@ func @matmul_loop_nested(%lb : index, %ub : index, %step : index, 4368 - // CHECK-DAG: %[[NEXT_PIPELINE_IDX:.*]] = arith.addi %[[PIPELINE_IDX]], %[[CONSTANT_1]] 4369 - // CHECK-DAG: %[[NEXT_LOOP_IDX:.*]] = arith.addi %[[LOOP_IDX]], %[[CONSTANT_1]] 4370 - // CHECK: scf.yield {{.*}}, {{.*}}, %[[NEXT_B_BUFFER]], %[[NEXT_B]], {{.*}}, {{.*}}, %[[NEXT_PIPELINE_IDX]], %[[NEXT_LOOP_IDX]] 4371 - -func @matmul_loop_single_pipeline(%lb : index, %ub : index, %step : index, 4372 - - %A : !tt.ptr<f16> {tt.divisibility = 16 : i32}, 4373 - +func.func @matmul_loop_single_pipeline(%lb : index, %ub : index, %step : index, 4374 - + %A : !tt.ptr<f16> {tt.divisibility = 16 : i32}, 4375 - %B : !tt.ptr<f16> {tt.divisibility = 16 : i32}) { 4376 - // A ptrs 4377 - %a_ptr_splat = tt.splat %A : (!tt.ptr<f16>) -> tensor<128x32x!tt.ptr<f16>, #AL> 4378 - diff --git a/test/TritonGPU/matmul.mlir b/test/TritonGPU/matmul.mlir 4379 - index 9bd5318e1e..01dc3f0ab1 100644 4380 - --- a/test/TritonGPU/matmul.mlir 4381 - +++ b/test/TritonGPU/matmul.mlir 4382 - @@ -4,7 +4,7 @@ 4383 - // CHECK: offset = 49152, size = 49152 4384 - // CHECK: size = 98304 4385 - module { 4386 - -func @matmul_kernel__Pfp32_Pfp32_Pfp32_i32_i32_i32_i32_i32_i32_i32_i32_i32__12c64_13c64_14c64_15c8(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg3: i32, %arg4: i32, %arg5: i32, %arg6: i32 {tt.divisibility = 16 : i32}, %arg7: i32, %arg8: i32 {tt.divisibility = 16 : i32}, %arg9: i32, %arg10: i32 {tt.divisibility = 16 : i32}, %arg11: i32) { 4387 - +func.func @matmul_kernel__Pfp32_Pfp32_Pfp32_i32_i32_i32_i32_i32_i32_i32_i32_i32__12c64_13c64_14c64_15c8(%arg0: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg1: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg2: !tt.ptr<f32> {tt.divisibility = 16 : i32}, %arg3: i32, %arg4: i32, %arg5: i32, %arg6: i32 {tt.divisibility = 16 : i32}, %arg7: i32, %arg8: i32 {tt.divisibility = 16 : i32}, %arg9: i32, %arg10: i32 {tt.divisibility = 16 : i32}, %arg11: i32) { 4388 - %cst = arith.constant dense<true> : tensor<64x64xi1> 4389 - %c64 = arith.constant 64 : index 4390 - %c0 = arith.constant 0 : index 4391 - @@ -22,7 +22,7 @@ func @matmul_kernel__Pfp32_Pfp32_Pfp32_i32_i32_i32_i32_i32_i32_i32_i32_i32__12c6 4392 - %7 = arith.muli %6, %c8_i32 : i32 4393 - %8 = arith.subi %2, %7 : i32 4394 - %9 = arith.cmpi slt, %8, %c8_i32 : i32 4395 - - %10 = select %9, %8, %c8_i32 : i32 4396 - + %10 = arith.select %9, %8, %c8_i32 : i32 4397 - %11 = arith.remsi %0, %10 : i32 4398 - %12 = arith.addi %7, %11 : i32 4399 - %13 = arith.remsi %0, %5 : i32 4400 - diff --git a/test/TritonGPU/prefetch.mlir b/test/TritonGPU/prefetch.mlir 4401 - index 52b4dddec1..b427547890 100644 4402 - --- a/test/TritonGPU/prefetch.mlir 4403 - +++ b/test/TritonGPU/prefetch.mlir 4404 - @@ -11,7 +11,7 @@ 4405 - #B_OP = #triton_gpu.dot_op<{opIdx = 1, parent = #C}> 4406 - 4407 - 4408 - -// CHECK: func @matmul_loop 4409 - +// CHECK: func.func @matmul_loop 4410 - // CHECK-DAG: %[[A0_PREFETCH_SMEM:.*]] = tensor.extract_slice %[[A0:.*]][0, 0] [128, 16] 4411 - // CHECK-DAG: %[[A0_PREFETCH:.*]] = triton_gpu.convert_layout %[[A0_PREFETCH_SMEM]] 4412 - // CHECK-DAG: %[[B0_PREFETCH_SMEM:.*]] = tensor.extract_slice %[[B0:.*]][0, 0] [16, 128] 4413 - @@ -28,7 +28,7 @@ 4414 - // CHECK-DAG: %[[NEXT_B_PREFETCH_SMEM:.*]] = tensor.extract_slice {{.*}}[0, 0] [16, 128] 4415 - // CHECK-DAG: %[[NEXT_B_PREFETCH:.*]] = triton_gpu.convert_layout %[[NEXT_B_PREFETCH_SMEM]] 4416 - // CHECK: scf.yield {{.*}}, {{.*}}, {{.*}}, {{.*}}, {{.*}}, %[[NEXT_A_PREFETCH]], %[[NEXT_B_PREFETCH]] 4417 - -func @matmul_loop(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>) { 4418 - +func.func @matmul_loop(%lb : index, %ub : index, %step : index, %A : !tt.ptr<f16>, %B : !tt.ptr<f16>) { 4419 - %a_ptr_init = tt.broadcast %A : (!tt.ptr<f16>) -> tensor<128x32x!tt.ptr<f16>, #AL> 4420 - %b_ptr_init = tt.broadcast %B : (!tt.ptr<f16>) -> tensor<32x128x!tt.ptr<f16>, #BL> 4421 - 4422 - diff --git a/test/TritonGPU/update-mma-for-volta.mlir b/test/TritonGPU/update-mma-for-volta.mlir 4423 - index d587fffcca..7571ec6185 100644 4424 - --- a/test/TritonGPU/update-mma-for-volta.mlir 4425 - +++ b/test/TritonGPU/update-mma-for-volta.mlir 4426 - @@ -15,7 +15,7 @@ 4427 - // CHECK: [[new_mma:#mma.*]] = #triton_gpu.mma<{versionMajor = 1, versionMinor = 3, warpsPerCTA = [4, 2]}> 4428 - module attributes {"triton_gpu.num-warps" = 16 : i32} { 4429 - // CHECK-LABEL: dot_mmav1 4430 - - func @dot_mmav1(%A: tensor<64x64xf16, #blocked0>, %B: tensor<64x64xf16, #blocked0>) -> tensor<64x64xf32, #blocked0> { 4431 - + func.func @dot_mmav1(%A: tensor<64x64xf16, #blocked0>, %B: tensor<64x64xf16, #blocked0>) -> tensor<64x64xf32, #blocked0> { 4432 - %C = arith.constant dense<0.000000e+00> : tensor<64x64xf32, #blocked0> 4433 - %AA = triton_gpu.convert_layout %A : (tensor<64x64xf16, #blocked0>) -> tensor<64x64xf16, #dot_operand_a> 4434 - %BB = triton_gpu.convert_layout %B : (tensor<64x64xf16, #blocked0>) -> tensor<64x64xf16, #dot_operand_b> 4435 - @@ -50,7 +50,7 @@ module attributes {"triton_gpu.num-warps" = 16 : i32} { 4436 - 4437 - module attributes {"triton_gpu.num-warps" = 16 : i32} { 4438 - // CHECK-LABEL: dot_mmav1 4439 - - func @dot_mmav1(%A: tensor<64x64xf16, #blocked0>, %B: tensor<64x64xf16, #blocked0>) -> tensor<64x64xf32, #blocked0> { 4440 - + func.func @dot_mmav1(%A: tensor<64x64xf16, #blocked0>, %B: tensor<64x64xf16, #blocked0>) -> tensor<64x64xf32, #blocked0> { 4441 - %C = arith.constant dense<0.000000e+00> : tensor<64x64xf32, #blocked0> 4442 - %AA = triton_gpu.convert_layout %A : (tensor<64x64xf16, #blocked0>) -> tensor<64x64xf16, #dot_operand_a> 4443 - %BB = triton_gpu.convert_layout %B : (tensor<64x64xf16, #blocked0>) -> tensor<64x64xf16, #dot_operand_b> 4444 - diff --git a/test/lib/Analysis/TestAlias.cpp b/test/lib/Analysis/TestAlias.cpp 4445 - index 88a4118fe9..3fd0cfd0d3 100644 4446 - --- a/test/lib/Analysis/TestAlias.cpp 4447 - +++ b/test/lib/Analysis/TestAlias.cpp 4448 - @@ -9,10 +9,10 @@ using namespace mlir; 4449 - namespace { 4450 - 4451 - struct TestAliasPass 4452 - - : public PassWrapper<TestAliasPass, OperationPass<FuncOp>> { 4453 - + : public PassWrapper<TestAliasPass, OperationPass<func::FuncOp>> { 4454 - + 4455 - + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TestAliasPass); 4456 - 4457 - - // LLVM15+ 4458 - - // MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TestAliasPass); 4459 - static void print(StringRef name, SmallVector<std::string, 4> &vals, 4460 - raw_ostream &os) { 4461 - if (vals.empty()) 4462 - @@ -39,23 +39,24 @@ struct TestAliasPass 4463 - auto opName = SymbolTable::getSymbolName(operation).getValue().str(); 4464 - os << opName << "\n"; 4465 - 4466 - - SharedMemoryAliasAnalysis analysis(&getContext()); 4467 - - analysis.run(operation); 4468 - + std::unique_ptr<DataFlowSolver> solver = createDataFlowSolver(); 4469 - + SharedMemoryAliasAnalysis *analysis = 4470 - + solver->load<SharedMemoryAliasAnalysis>(); 4471 - + if (failed(solver->initializeAndRun(operation))) 4472 - + return signalPassFailure(); 4473 - 4474 - AsmState state(operation->getParentOfType<ModuleOp>()); 4475 - // Get operation ids of value's aliases 4476 - auto getAllocOpNames = [&](Value value) { 4477 - - LatticeElement<AliasInfo> *latticeElement = 4478 - - analysis.lookupLatticeElement(value); 4479 - + dataflow::Lattice<AliasInfo> *latticeElement = 4480 - + analysis->getLatticeElement(value); 4481 - SmallVector<std::string, 4> opNames; 4482 - - if (latticeElement) { 4483 - + if (latticeElement && !latticeElement->isUninitialized()) { 4484 - auto &info = latticeElement->getValue(); 4485 - - if (!info.getAllocs().empty()) { 4486 - - for (auto &alias : info.getAllocs()) { 4487 - - auto opName = 4488 - - getValueOperandName(alias.getDefiningOp()->getResult(0), state); 4489 - - opNames.push_back(std::move(opName)); 4490 - - } 4491 - + for (auto &alias : info.getAllocs()) { 4492 - + auto opName = 4493 - + getValueOperandName(alias.getDefiningOp()->getResult(0), state); 4494 - + opNames.push_back(std::move(opName)); 4495 - } 4496 - } 4497 - // Ensure deterministic output 4498 - diff --git a/test/lib/Analysis/TestAllocation.cpp b/test/lib/Analysis/TestAllocation.cpp 4499 - index 84108c4d36..35e42242bd 100644 4500 - --- a/test/lib/Analysis/TestAllocation.cpp 4501 - +++ b/test/lib/Analysis/TestAllocation.cpp 4502 - @@ -6,10 +6,9 @@ using namespace mlir; 4503 - namespace { 4504 - 4505 - struct TestAllocationPass 4506 - - : public PassWrapper<TestAllocationPass, OperationPass<FuncOp>> { 4507 - + : public PassWrapper<TestAllocationPass, OperationPass<func::FuncOp>> { 4508 - 4509 - - // LLVM15+ 4510 - - // MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TestAllocationPass); 4511 - + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TestAllocationPass); 4512 - 4513 - StringRef getArgument() const final { return "test-print-allocation"; } 4514 - StringRef getDescription() const final { 4515 - diff --git a/test/lib/Analysis/TestAxisInfo.cpp b/test/lib/Analysis/TestAxisInfo.cpp 4516 - index a5205bb0a0..22347c32f0 100644 4517 - --- a/test/lib/Analysis/TestAxisInfo.cpp 4518 - +++ b/test/lib/Analysis/TestAxisInfo.cpp 4519 - @@ -1,25 +1,15 @@ 4520 - #include "mlir/Pass/Pass.h" 4521 - #include "triton/Analysis/AxisInfo.h" 4522 - +#include "triton/Analysis/Utility.h" 4523 - 4524 - using namespace mlir; 4525 - 4526 - namespace { 4527 - 4528 - struct TestAxisInfoPass 4529 - - : public PassWrapper<TestAxisInfoPass, OperationPass<FuncOp>> { 4530 - + : public PassWrapper<TestAxisInfoPass, OperationPass<func::FuncOp>> { 4531 - 4532 - - // LLVM15+ 4533 - - // MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TestAlignmentPass); 4534 - - 4535 - - void print(const std::string &name, raw_ostream &os, ArrayRef<int64_t> vals) { 4536 - - os << name << ": ["; 4537 - - for (size_t d = 0; d < vals.size(); d++) { 4538 - - if (d != 0) 4539 - - os << ", "; 4540 - - os << vals[d]; 4541 - - } 4542 - - os << "]"; 4543 - - } 4544 - + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TestAxisInfoPass); 4545 - 4546 - StringRef getArgument() const final { return "test-print-alignment"; } 4547 - StringRef getDescription() const final { 4548 - @@ -30,38 +20,19 @@ struct TestAxisInfoPass 4549 - Operation *operation = getOperation(); 4550 - auto &os = llvm::errs(); 4551 - auto opName = SymbolTable::getSymbolName(operation).getValue().str(); 4552 - - os << opName << "\n"; 4553 - - AxisInfoAnalysis analysis(&getContext()); 4554 - - analysis.run(operation); 4555 - + os << "@" << opName << "\n"; 4556 - + 4557 - + std::unique_ptr<DataFlowSolver> solver = createDataFlowSolver(); 4558 - + AxisInfoAnalysis *analysis = solver->load<AxisInfoAnalysis>(); 4559 - + if (failed(solver->initializeAndRun(operation))) 4560 - + return signalPassFailure(); 4561 - operation->walk([&](Operation *op) { 4562 - if (op->getNumResults() < 1) 4563 - return; 4564 - for (Value result : op->getResults()) { 4565 - - // std::ostringstream oss; 4566 - - // result.print(oss); 4567 - - // os << " => "; 4568 - - LatticeElement<AxisInfo> *latticeElement = 4569 - - analysis.lookupLatticeElement(result); 4570 - - if (!latticeElement) { 4571 - - os << "None\n"; 4572 - - return; 4573 - - } 4574 - - AxisInfo &info = latticeElement->getValue(); 4575 - - print("Contiguity", os, info.getContiguity()); 4576 - - os << " ; "; 4577 - - print("Divisibility", os, info.getDivisibility()); 4578 - - os << " ; "; 4579 - - print("Constancy", os, info.getConstancy()); 4580 - - os << " ; "; 4581 - - auto constantValue = info.getConstantValue(); 4582 - - os << "ConstantValue: ["; 4583 - - if (constantValue.has_value()) 4584 - - os << constantValue.value(); 4585 - - else 4586 - - os << "None"; 4587 - - os << "] ( "; 4588 - result.print(os); 4589 - - os << " ) "; 4590 - + os << " => "; 4591 - + analysis->getLatticeElement(result)->getValue().print(os); 4592 - os << "\n"; 4593 - } 4594 - }); 4595 - diff --git a/test/lib/Analysis/TestMembar.cpp b/test/lib/Analysis/TestMembar.cpp 4596 - index df4279fe24..ab9b9f3fb7 100644 4597 - --- a/test/lib/Analysis/TestMembar.cpp 4598 - +++ b/test/lib/Analysis/TestMembar.cpp 4599 - @@ -1,4 +1,4 @@ 4600 - -#include "mlir/Dialect/GPU/GPUDialect.h" 4601 - +#include "mlir/Dialect/GPU/IR/GPUDialect.h" 4602 - #include "mlir/IR/Dialect.h" 4603 - #include "mlir/Pass/Pass.h" 4604 - #include "triton/Analysis/Allocation.h" 4605 - @@ -9,10 +9,9 @@ using namespace mlir; 4606 - namespace { 4607 - 4608 - struct TestMembarPass 4609 - - : public PassWrapper<TestMembarPass, OperationPass<FuncOp>> { 4610 - + : public PassWrapper<TestMembarPass, OperationPass<func::FuncOp>> { 4611 - 4612 - - // LLVM15+ 4613 - - // MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TestMembarPass); 4614 - + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TestMembarPass); 4615 - 4616 - StringRef getArgument() const final { return "test-print-membar"; } 4617 - StringRef getDescription() const final {
+15 -13
pkgs/development/python-modules/torch/default.nix
··· 43 43 44 44 # ROCm dependencies 45 45 rocmSupport ? false, 46 - gpuTargets ? [ ], 47 - openmp, rocm-core, hip, rccl, miopen, miopengemm, rocrand, rocblas, 48 - rocfft, rocsparse, hipsparse, rocthrust, rocprim, hipcub, roctracer, 49 - rocsolver, hipfft, hipsolver, hipblas, rocminfo, rocm-thunk, rocm-comgr, 50 - rocm-device-libs, rocm-runtime, rocm-opencl-runtime, hipify 46 + gpuTargets ? [ ], rocmPackages 51 47 }: 52 48 53 49 let ··· 89 85 else if cudaSupport then 90 86 gpuArchWarner supportedCudaCapabilities unsupportedCudaCapabilities 91 87 else if rocmSupport then 92 - hip.gpuTargets 88 + rocmPackages.clr.gpuTargets 93 89 else 94 90 throw "No GPU targets specified" 95 91 ); ··· 97 93 rocmtoolkit_joined = symlinkJoin { 98 94 name = "rocm-merged"; 99 95 100 - paths = [ 101 - rocm-core hip rccl miopen miopengemm rocrand rocblas 102 - rocfft rocsparse hipsparse rocthrust rocprim hipcub 103 - roctracer rocfft rocsolver hipfft hipsolver hipblas 96 + paths = with rocmPackages; [ 97 + rocm-core clr rccl miopen miopengemm rocrand rocblas 98 + rocsparse hipsparse rocthrust rocprim hipcub 99 + roctracer # Unfree at the moment due to hsa-amd-aqlprofile hard dependency in rocprofiler 100 + rocfft rocsolver hipfft hipsolver hipblas 104 101 rocminfo rocm-thunk rocm-comgr rocm-device-libs 105 - rocm-runtime rocm-opencl-runtime hipify 102 + rocm-runtime clr.icd hipify 106 103 ]; 104 + 105 + # Fix `setuptools` not being found 106 + postBuild = '' 107 + rm -rf $out/nix-support 108 + ''; 107 109 }; 108 110 109 111 brokenConditions = attrsets.filterAttrs (_: cond: cond) { ··· 170 172 # Strangely, this is never set in cmake 171 173 substituteInPlace cmake/public/LoadHIP.cmake \ 172 174 --replace "set(ROCM_PATH \$ENV{ROCM_PATH})" \ 173 - "set(ROCM_PATH \$ENV{ROCM_PATH})''\nset(ROCM_VERSION ${lib.concatStrings (lib.intersperse "0" (lib.splitString "." hip.version))})" 175 + "set(ROCM_PATH \$ENV{ROCM_PATH})''\nset(ROCM_VERSION ${lib.concatStrings (lib.intersperse "0" (lib.splitString "." rocmPackages.clr.version))})" 174 176 '' 175 177 # Detection of NCCL version doesn't work particularly well when using the static binary. 176 178 + lib.optionalString cudaSupport '' ··· 323 325 ] ++ lists.optionals (strings.versionAtLeast cudaVersion "11.8") [ 324 326 cuda_profiler_api.dev # <cuda_profiler_api.h> 325 327 ]) 326 - ++ lib.optionals rocmSupport [ openmp ] 328 + ++ lib.optionals rocmSupport [ rocmPackages.llvm.openmp ] 327 329 ++ lib.optionals (cudaSupport || rocmSupport) [ magma ] 328 330 ++ lib.optionals stdenv.isLinux [ numactl ] 329 331 ++ lib.optionals stdenv.isDarwin [ Accelerate CoreServices libobjc ];
+165
pkgs/development/rocm-modules/5/clr/default.nix
··· 1 + { lib 2 + , stdenv 3 + , callPackage 4 + , fetchFromGitHub 5 + , rocmUpdateScript 6 + , makeWrapper 7 + , cmake 8 + , perl 9 + , clang 10 + , hip-common 11 + , hipcc 12 + , rocm-device-libs 13 + , rocm-comgr 14 + , rocm-runtime 15 + , roctracer 16 + , rocminfo 17 + , rocm-smi 18 + , numactl 19 + , libGL 20 + , libxml2 21 + , libX11 22 + , python3Packages 23 + }: 24 + 25 + let 26 + wrapperArgs = [ 27 + "--prefix PATH : $out/bin" 28 + "--prefix LD_LIBRARY_PATH : ${rocm-runtime}" 29 + "--set HIP_PLATFORM amd" 30 + "--set HIP_PATH $out" 31 + "--set HIP_CLANG_PATH ${clang}/bin" 32 + "--set DEVICE_LIB_PATH ${rocm-device-libs}/amdgcn/bitcode" 33 + "--set HSA_PATH ${rocm-runtime}" 34 + "--set ROCM_PATH $out" 35 + ]; 36 + in stdenv.mkDerivation (finalAttrs: { 37 + pname = "clr"; 38 + version = "5.7.0"; 39 + 40 + outputs = [ 41 + "out" 42 + "icd" 43 + ]; 44 + 45 + src = fetchFromGitHub { 46 + owner = "ROCm-Developer-Tools"; 47 + repo = "clr"; 48 + rev = "rocm-${finalAttrs.version}"; 49 + hash = "sha256-C+rFW/7kf35rz0sQTI2+iY5RhZZQY07fc5a+e6cB5OQ="; 50 + }; 51 + 52 + nativeBuildInputs = [ 53 + makeWrapper 54 + cmake 55 + perl 56 + python3Packages.python 57 + python3Packages.cppheaderparser 58 + ]; 59 + 60 + buildInputs = [ 61 + numactl 62 + libGL 63 + libxml2 64 + libX11 65 + ]; 66 + 67 + propagatedBuildInputs = [ 68 + rocm-device-libs 69 + rocm-comgr 70 + rocm-runtime 71 + rocminfo 72 + ]; 73 + 74 + cmakeFlags = [ 75 + "-DCMAKE_POLICY_DEFAULT_CMP0072=NEW" # Prefer newer OpenGL libraries 76 + "-DCLR_BUILD_HIP=ON" 77 + "-DCLR_BUILD_OCL=ON" 78 + "-DHIP_COMMON_DIR=${hip-common}" 79 + "-DHIPCC_BIN_DIR=${hipcc}/bin" 80 + "-DHIP_PLATFORM=amd" 81 + "-DPROF_API_HEADER_PATH=${roctracer.src}/inc/ext" 82 + "-DROCM_PATH=${rocminfo}" 83 + 84 + # Temporarily set variables to work around upstream CMakeLists issue 85 + # Can be removed once https://github.com/ROCm-Developer-Tools/hipamd/issues/55 is fixed 86 + "-DCMAKE_INSTALL_BINDIR=bin" 87 + "-DCMAKE_INSTALL_INCLUDEDIR=include" 88 + "-DCMAKE_INSTALL_LIBDIR=lib" 89 + ]; 90 + 91 + postPatch = '' 92 + patchShebangs hipamd/src 93 + 94 + # We're not on Windows so these are never installed to hipcc... 95 + substituteInPlace hipamd/CMakeLists.txt \ 96 + --replace "install(PROGRAMS \''${HIPCC_BIN_DIR}/hipcc.bat DESTINATION bin)" "" \ 97 + --replace "install(PROGRAMS \''${HIPCC_BIN_DIR}/hipconfig.bat DESTINATION bin)" "" 98 + 99 + substituteInPlace hipamd/src/hip_embed_pch.sh \ 100 + --replace "\''$LLVM_DIR/bin/clang" "${clang}/bin/clang" 101 + ''; 102 + 103 + postInstall = '' 104 + patchShebangs $out/bin 105 + 106 + # hipcc.bin and hipconfig.bin is mysteriously never installed 107 + cp -a ${hipcc}/bin/{hipcc.bin,hipconfig.bin} $out/bin 108 + 109 + wrapProgram $out/bin/hipcc.bin ${lib.concatStringsSep " " wrapperArgs} 110 + wrapProgram $out/bin/hipconfig.bin ${lib.concatStringsSep " " wrapperArgs} 111 + wrapProgram $out/bin/hipcc.pl ${lib.concatStringsSep " " wrapperArgs} 112 + wrapProgram $out/bin/hipconfig.pl ${lib.concatStringsSep " " wrapperArgs} 113 + 114 + # Just link rocminfo, it's easier 115 + ln -s ${rocminfo}/bin/* $out/bin 116 + 117 + # Replace rocm-opencl-icd functionality 118 + mkdir -p $icd/etc/OpenCL/vendors 119 + echo "$out/lib/libamdocl64.so" > $icd/etc/OpenCL/vendors/amdocl64.icd 120 + ''; 121 + 122 + passthru = { 123 + # All known and valid general GPU targets 124 + # We cannot use this for each ROCm library, as each defines their own supported targets 125 + # See: https://github.com/RadeonOpenCompute/ROCm/blob/77cbac4abab13046ee93d8b5bf410684caf91145/README.md#library-target-matrix 126 + gpuTargets = lib.forEach [ 127 + "803" 128 + "900" 129 + "906" 130 + "908" 131 + "90a" 132 + "940" 133 + "941" 134 + "942" 135 + "1010" 136 + "1012" 137 + "1030" 138 + "1100" 139 + "1101" 140 + "1102" 141 + ] (target: "gfx${target}"); 142 + 143 + updateScript = rocmUpdateScript { 144 + name = finalAttrs.pname; 145 + owner = finalAttrs.src.owner; 146 + repo = finalAttrs.src.repo; 147 + }; 148 + 149 + impureTests = { 150 + clr-icd = callPackage ./test.nix { 151 + inherit rocm-smi; 152 + clr = finalAttrs.finalPackage; 153 + }; 154 + }; 155 + }; 156 + 157 + meta = with lib; { 158 + description = "AMD Common Language Runtime for hipamd, opencl, and rocclr"; 159 + homepage = "https://github.com/ROCm-Developer-Tools/clr"; 160 + license = with licenses; [ mit ]; 161 + maintainers = with maintainers; [ lovesegfault ] ++ teams.rocm.members; 162 + platforms = platforms.linux; 163 + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 164 + }; 165 + })
+272
pkgs/development/rocm-modules/5/default.nix
··· 1 + { callPackage 2 + , recurseIntoAttrs 3 + , cudaPackages 4 + , python3Packages 5 + , elfutils 6 + , boost179 7 + }: 8 + 9 + let 10 + rocmUpdateScript = callPackage ./update.nix { }; 11 + in rec { 12 + ## RadeonOpenCompute ## 13 + llvm = recurseIntoAttrs (callPackage ./llvm/default.nix { inherit rocmUpdateScript rocm-device-libs rocm-runtime rocm-thunk clr; }); 14 + 15 + rocm-core = callPackage ./rocm-core { 16 + inherit rocmUpdateScript; 17 + stdenv = llvm.rocmClangStdenv; 18 + }; 19 + 20 + rocm-cmake = callPackage ./rocm-cmake { 21 + inherit rocmUpdateScript; 22 + stdenv = llvm.rocmClangStdenv; 23 + }; 24 + 25 + rocm-thunk = callPackage ./rocm-thunk { 26 + inherit rocmUpdateScript; 27 + stdenv = llvm.rocmClangStdenv; 28 + }; 29 + 30 + rocm-smi = python3Packages.callPackage ./rocm-smi { 31 + inherit rocmUpdateScript; 32 + stdenv = llvm.rocmClangStdenv; 33 + }; 34 + 35 + # Eventually will be in the LLVM repo 36 + rocm-device-libs = callPackage ./rocm-device-libs { 37 + inherit rocmUpdateScript rocm-cmake; 38 + stdenv = llvm.rocmClangStdenv; 39 + }; 40 + 41 + rocm-runtime = callPackage ./rocm-runtime { 42 + inherit rocmUpdateScript rocm-device-libs rocm-thunk; 43 + stdenv = llvm.rocmClangStdenv; 44 + }; 45 + 46 + # Eventually will be in the LLVM repo 47 + rocm-comgr = callPackage ./rocm-comgr { 48 + inherit rocmUpdateScript rocm-cmake rocm-device-libs; 49 + stdenv = llvm.rocmClangStdenv; 50 + }; 51 + 52 + rocminfo = callPackage ./rocminfo { 53 + inherit rocmUpdateScript rocm-cmake rocm-runtime; 54 + stdenv = llvm.rocmClangStdenv; 55 + }; 56 + 57 + clang-ocl = callPackage ./clang-ocl { 58 + inherit rocmUpdateScript rocm-cmake rocm-device-libs; 59 + stdenv = llvm.rocmClangStdenv; 60 + }; 61 + 62 + # Unfree 63 + hsa-amd-aqlprofile-bin = callPackage ./hsa-amd-aqlprofile-bin { 64 + stdenv = llvm.rocmClangStdenv; 65 + }; 66 + 67 + # Broken, too many errors 68 + rdc = callPackage ./rdc { 69 + inherit rocmUpdateScript rocm-smi rocm-runtime; 70 + # stdenv = llvm.rocmClangStdenv; 71 + }; 72 + 73 + rocm-docs-core = python3Packages.callPackage ./rocm-docs-core { }; 74 + 75 + ## ROCm-Developer-Tools ## 76 + hip-common = callPackage ./hip-common { 77 + inherit rocmUpdateScript; 78 + stdenv = llvm.rocmClangStdenv; 79 + }; 80 + 81 + # Eventually will be in the LLVM repo 82 + hipcc = callPackage ./hipcc { 83 + inherit rocmUpdateScript; 84 + stdenv = llvm.rocmClangStdenv; 85 + }; 86 + 87 + # Replaces hip, opencl-runtime, and rocclr 88 + clr = callPackage ./clr { 89 + inherit rocmUpdateScript hip-common hipcc rocm-device-libs rocm-comgr rocm-runtime roctracer rocminfo rocm-smi; 90 + inherit (llvm) clang; 91 + stdenv = llvm.rocmClangStdenv; 92 + }; 93 + 94 + hipify = callPackage ./hipify { 95 + inherit rocmUpdateScript; 96 + inherit (llvm) clang; 97 + stdenv = llvm.rocmClangStdenv; 98 + }; 99 + 100 + # Needs GCC 101 + rocprofiler = callPackage ./rocprofiler { 102 + inherit (llvm) clang; 103 + inherit rocmUpdateScript clr rocm-thunk roctracer rocm-smi hsa-amd-aqlprofile-bin; 104 + }; 105 + 106 + # Needs GCC 107 + roctracer = callPackage ./roctracer { 108 + inherit rocmUpdateScript rocm-device-libs rocm-runtime rocprofiler clr; 109 + inherit (llvm) clang; 110 + }; 111 + 112 + # Needs GCC 113 + rocgdb = callPackage ./rocgdb { 114 + inherit rocmUpdateScript; 115 + elfutils = elfutils.override { enableDebuginfod = true; }; 116 + }; 117 + 118 + rocdbgapi = callPackage ./rocdbgapi { 119 + inherit rocmUpdateScript rocm-cmake rocm-comgr rocm-runtime; 120 + stdenv = llvm.rocmClangStdenv; 121 + }; 122 + 123 + rocr-debug-agent = callPackage ./rocr-debug-agent { 124 + inherit rocmUpdateScript clr rocdbgapi; 125 + stdenv = llvm.rocmClangStdenv; 126 + }; 127 + 128 + ## ROCmSoftwarePlatform ## 129 + rocprim = callPackage ./rocprim { 130 + inherit rocmUpdateScript rocm-cmake clr; 131 + stdenv = llvm.rocmClangStdenv; 132 + }; 133 + 134 + rocsparse = callPackage ./rocsparse { 135 + inherit rocmUpdateScript rocm-cmake rocprim clr; 136 + stdenv = llvm.rocmClangStdenv; 137 + }; 138 + 139 + rocthrust = callPackage ./rocthrust { 140 + inherit rocmUpdateScript rocm-cmake rocprim clr; 141 + stdenv = llvm.rocmClangStdenv; 142 + }; 143 + 144 + rocrand = callPackage ./rocrand { 145 + inherit rocmUpdateScript rocm-cmake clr; 146 + stdenv = llvm.rocmClangStdenv; 147 + }; 148 + 149 + hiprand = rocrand; # rocrand includes hiprand 150 + 151 + rocfft = callPackage ./rocfft { 152 + inherit rocmUpdateScript rocm-cmake rocrand rocfft clr; 153 + inherit (llvm) openmp; 154 + stdenv = llvm.rocmClangStdenv; 155 + }; 156 + 157 + rccl = callPackage ./rccl { 158 + inherit rocmUpdateScript rocm-cmake rocm-smi clr hipify; 159 + stdenv = llvm.rocmClangStdenv; 160 + }; 161 + 162 + hipcub = callPackage ./hipcub { 163 + inherit rocmUpdateScript rocm-cmake rocprim clr; 164 + stdenv = llvm.rocmClangStdenv; 165 + }; 166 + 167 + hipsparse = callPackage ./hipsparse { 168 + inherit rocmUpdateScript rocm-cmake rocsparse clr; 169 + inherit (llvm) openmp; 170 + stdenv = llvm.rocmClangStdenv; 171 + }; 172 + 173 + hipfort = callPackage ./hipfort { 174 + inherit rocmUpdateScript rocm-cmake; 175 + stdenv = llvm.rocmClangStdenv; 176 + }; 177 + 178 + hipfft = callPackage ./hipfft { 179 + inherit rocmUpdateScript rocm-cmake rocfft clr; 180 + inherit (llvm) openmp; 181 + stdenv = llvm.rocmClangStdenv; 182 + }; 183 + 184 + tensile = python3Packages.callPackage ./tensile { 185 + inherit rocmUpdateScript rocminfo; 186 + stdenv = llvm.rocmClangStdenv; 187 + }; 188 + 189 + rocblas = callPackage ./rocblas { 190 + inherit rocmUpdateScript rocm-cmake clr tensile; 191 + inherit (llvm) openmp; 192 + stdenv = llvm.rocmClangStdenv; 193 + }; 194 + 195 + rocsolver = callPackage ./rocsolver { 196 + inherit rocmUpdateScript rocm-cmake rocblas rocsparse clr; 197 + stdenv = llvm.rocmClangStdenv; 198 + }; 199 + 200 + rocwmma = callPackage ./rocwmma { 201 + inherit rocmUpdateScript rocm-cmake rocm-smi rocblas clr; 202 + inherit (llvm) openmp; 203 + stdenv = llvm.rocmClangStdenv; 204 + }; 205 + 206 + rocalution = callPackage ./rocalution { 207 + inherit rocmUpdateScript rocm-cmake rocprim rocsparse rocrand rocblas clr; 208 + inherit (llvm) openmp; 209 + stdenv = llvm.rocmClangStdenv; 210 + }; 211 + 212 + rocmlir = callPackage ./rocmlir { 213 + inherit rocmUpdateScript rocm-cmake clr; 214 + stdenv = llvm.rocmClangStdenv; 215 + }; 216 + 217 + rocmlir-rock = rocmlir.override { 218 + buildRockCompiler = true; 219 + }; 220 + 221 + hipsolver = callPackage ./hipsolver { 222 + inherit rocmUpdateScript rocm-cmake rocblas rocsolver clr; 223 + stdenv = llvm.rocmClangStdenv; 224 + }; 225 + 226 + hipblas = callPackage ./hipblas { 227 + inherit rocmUpdateScript rocm-cmake rocblas rocsolver clr; 228 + stdenv = llvm.rocmClangStdenv; 229 + }; 230 + 231 + # hipBlasLt - Very broken with Tensile at the moment, only supports GFX9 232 + # hipTensor - Only supports GFX9 233 + 234 + miopengemm = callPackage ./miopengemm { 235 + inherit rocmUpdateScript rocm-cmake clr; 236 + stdenv = llvm.rocmClangStdenv; 237 + }; 238 + 239 + composable_kernel = callPackage ./composable_kernel { 240 + inherit rocmUpdateScript rocm-cmake clr; 241 + inherit (llvm) openmp clang-tools-extra; 242 + stdenv = llvm.rocmClangStdenv; 243 + }; 244 + 245 + half = callPackage ./half { 246 + inherit rocmUpdateScript rocm-cmake; 247 + stdenv = llvm.rocmClangStdenv; 248 + }; 249 + 250 + miopen = callPackage ./miopen { 251 + inherit rocmUpdateScript rocm-cmake rocblas clang-ocl miopengemm composable_kernel rocm-comgr clr rocm-docs-core half; 252 + inherit (llvm) clang-tools-extra; 253 + stdenv = llvm.rocmClangStdenv; 254 + rocmlir = rocmlir-rock; 255 + boost = boost179.override { enableStatic = true; }; 256 + }; 257 + 258 + miopen-hip = miopen.override { 259 + useOpenCL = false; 260 + }; 261 + 262 + miopen-opencl = miopen.override { 263 + useOpenCL = true; 264 + }; 265 + 266 + migraphx = callPackage ./migraphx { 267 + inherit rocmUpdateScript rocm-cmake rocblas composable_kernel miopengemm miopen clr half rocm-device-libs; 268 + inherit (llvm) openmp clang-tools-extra; 269 + stdenv = llvm.rocmClangStdenv; 270 + rocmlir = rocmlir-rock; 271 + }; 272 + }
+39
pkgs/development/rocm-modules/5/half/default.nix
··· 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , rocmUpdateScript 5 + , cmake 6 + , rocm-cmake 7 + }: 8 + 9 + stdenv.mkDerivation (finalAttrs: { 10 + pname = "half"; 11 + version = "5.7.0"; 12 + 13 + src = fetchFromGitHub { 14 + owner = "ROCmSoftwarePlatform"; 15 + repo = "half"; 16 + rev = "rocm-${finalAttrs.version}"; 17 + hash = "sha256-82It+/wm8+umBdQYn7lz/fS69h+f0mzwPdGxoJNYUq0="; 18 + }; 19 + 20 + nativeBuildInputs = [ 21 + cmake 22 + rocm-cmake 23 + ]; 24 + 25 + passthru.updateScript = rocmUpdateScript { 26 + name = finalAttrs.pname; 27 + owner = finalAttrs.src.owner; 28 + repo = finalAttrs.src.repo; 29 + }; 30 + 31 + meta = with lib; { 32 + description = "C++ library for half precision floating point arithmetics"; 33 + homepage = "https://github.com/ROCmSoftwarePlatform/half"; 34 + license = with licenses; [ mit ]; 35 + maintainers = teams.rocm.members; 36 + platforms = platforms.unix; 37 + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 38 + }; 39 + })
+46
pkgs/development/rocm-modules/5/hipcc/default.nix
··· 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , rocmUpdateScript 5 + , cmake 6 + , lsb-release 7 + }: 8 + 9 + stdenv.mkDerivation (finalAttrs: { 10 + pname = "hipcc"; 11 + version = "5.7.0"; 12 + 13 + src = fetchFromGitHub { 14 + owner = "ROCm-Developer-Tools"; 15 + repo = "HIPCC"; 16 + rev = "rocm-${finalAttrs.version}"; 17 + hash = "sha256-lJX6nF1V4YmK5ai7jivXlRnG3doIOf6X9CWLHVdRuVg="; 18 + }; 19 + 20 + nativeBuildInputs = [ cmake ]; 21 + 22 + postPatch = '' 23 + substituteInPlace src/hipBin_amd.h \ 24 + --replace "/usr/bin/lsb_release" "${lsb-release}/bin/lsb_release" 25 + ''; 26 + 27 + postInstall = '' 28 + rm -r $out/hip/bin 29 + ln -s $out/bin $out/hip/bin 30 + ''; 31 + 32 + passthru.updateScript = rocmUpdateScript { 33 + name = finalAttrs.pname; 34 + owner = finalAttrs.src.owner; 35 + repo = finalAttrs.src.repo; 36 + }; 37 + 38 + meta = with lib; { 39 + description = "Compiler driver utility that calls clang or nvcc"; 40 + homepage = "https://github.com/ROCm-Developer-Tools/HIPCC"; 41 + license = with licenses; [ mit ]; 42 + maintainers = with maintainers; [ lovesegfault ] ++ teams.rocm.members; 43 + platforms = platforms.linux; 44 + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 45 + }; 46 + })
+45
pkgs/development/rocm-modules/5/hsa-amd-aqlprofile-bin/default.nix
··· 1 + { lib 2 + , stdenv 3 + , fetchurl 4 + , dpkg 5 + }: 6 + 7 + let 8 + prefix = "hsa-amd-aqlprofile"; 9 + version = "5.7.0"; 10 + major = lib.versions.major version; 11 + minor = lib.versions.minor version; 12 + patch = lib.versions.patch version; 13 + magic = lib.strings.concatStrings (lib.strings.intersperse "0" (lib.versions.splitVersion version)); 14 + in stdenv.mkDerivation (finalAttrs: { 15 + inherit version; 16 + pname = "${prefix}-bin"; 17 + 18 + src = fetchurl { 19 + url = "https://repo.radeon.com/rocm/apt/${major}.${minor}/pool/main/h/${prefix}/${prefix}_1.0.0.${magic}.${magic}-63~22.04_amd64.deb"; 20 + hash = "sha256-FQ25eXkhnvOmcf0sGW3GYu9kZj69bVvZrh0jVx/G/kI="; 21 + }; 22 + 23 + nativeBuildInputs = [ dpkg ]; 24 + dontPatch = true; 25 + dontConfigure = true; 26 + dontBuild = true; 27 + 28 + installPhase = '' 29 + runHook preInstall 30 + 31 + mkdir -p $out 32 + cp -a opt/rocm-${version}/* $out 33 + 34 + runHook postInstall 35 + ''; 36 + 37 + meta = with lib; { 38 + description = "AQLPROFILE library for AMD HSA runtime API extension support"; 39 + homepage = "https://rocm.docs.amd.com/en/latest/"; 40 + license = with licenses; [ unfree ]; 41 + maintainers = teams.rocm.members; 42 + platforms = platforms.linux; 43 + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 44 + }; 45 + })
+57
pkgs/development/rocm-modules/5/llvm/default.nix
··· 1 + { stdenv 2 + , callPackage 3 + , rocmUpdateScript 4 + , wrapBintoolsWith 5 + , overrideCC 6 + , rocm-device-libs 7 + , rocm-runtime 8 + , rocm-thunk 9 + , clr 10 + }: 11 + 12 + let 13 + ## Stage 1 ## 14 + # Projects 15 + llvm = callPackage ./stage-1/llvm.nix { inherit rocmUpdateScript; }; 16 + clang-unwrapped = callPackage ./stage-1/clang-unwrapped.nix { inherit rocmUpdateScript llvm; }; 17 + lld = callPackage ./stage-1/lld.nix { inherit rocmUpdateScript llvm; }; 18 + 19 + # Runtimes 20 + runtimes = callPackage ./stage-1/runtimes.nix { inherit rocmUpdateScript llvm; }; 21 + 22 + ## Stage 2 ## 23 + # Helpers 24 + bintools-unwrapped = callPackage ./stage-2/bintools-unwrapped.nix { inherit llvm lld; }; 25 + bintools = wrapBintoolsWith { bintools = bintools-unwrapped; }; 26 + rStdenv = callPackage ./stage-2/rstdenv.nix { inherit llvm clang-unwrapped lld runtimes bintools; }; 27 + in rec { 28 + inherit 29 + llvm 30 + clang-unwrapped 31 + lld 32 + bintools; 33 + 34 + # Runtimes 35 + libc = callPackage ./stage-2/libc.nix { inherit rocmUpdateScript; stdenv = rStdenv; }; 36 + libunwind = callPackage ./stage-2/libunwind.nix { inherit rocmUpdateScript; stdenv = rStdenv; }; 37 + libcxxabi = callPackage ./stage-2/libcxxabi.nix { inherit rocmUpdateScript; stdenv = rStdenv; }; 38 + libcxx = callPackage ./stage-2/libcxx.nix { inherit rocmUpdateScript; stdenv = rStdenv; }; 39 + compiler-rt = callPackage ./stage-2/compiler-rt.nix { inherit rocmUpdateScript llvm; stdenv = rStdenv; }; 40 + 41 + ## Stage 3 ## 42 + # Helpers 43 + clang = callPackage ./stage-3/clang.nix { inherit llvm lld clang-unwrapped bintools libc libunwind libcxxabi libcxx compiler-rt; }; 44 + rocmClangStdenv = overrideCC stdenv clang; 45 + 46 + # Projects 47 + clang-tools-extra = callPackage ./stage-3/clang-tools-extra.nix { inherit rocmUpdateScript llvm clang-unwrapped; stdenv = rocmClangStdenv; }; 48 + libclc = callPackage ./stage-3/libclc.nix { inherit rocmUpdateScript llvm clang; stdenv = rocmClangStdenv; }; 49 + lldb = callPackage ./stage-3/lldb.nix { inherit rocmUpdateScript clang; stdenv = rocmClangStdenv; }; 50 + mlir = callPackage ./stage-3/mlir.nix { inherit rocmUpdateScript clr; stdenv = rocmClangStdenv; }; 51 + polly = callPackage ./stage-3/polly.nix { inherit rocmUpdateScript; stdenv = rocmClangStdenv; }; 52 + flang = callPackage ./stage-3/flang.nix { inherit rocmUpdateScript clang-unwrapped mlir; stdenv = rocmClangStdenv; }; 53 + openmp = callPackage ./stage-3/openmp.nix { inherit rocmUpdateScript llvm clang-unwrapped clang rocm-device-libs rocm-runtime rocm-thunk; stdenv = rocmClangStdenv; }; 54 + 55 + # Runtimes 56 + pstl = callPackage ./stage-3/pstl.nix { inherit rocmUpdateScript; stdenv = rocmClangStdenv; }; 57 + }
+46
pkgs/development/rocm-modules/5/llvm/stage-1/clang-unwrapped.nix
··· 1 + { callPackage 2 + , rocmUpdateScript 3 + , llvm 4 + }: 5 + 6 + callPackage ../base.nix rec { 7 + inherit rocmUpdateScript; 8 + targetName = "clang-unwrapped"; 9 + targetDir = "clang"; 10 + extraBuildInputs = [ llvm ]; 11 + 12 + extraCMakeFlags = [ 13 + "-DCLANG_INCLUDE_DOCS=ON" 14 + "-DCLANG_INCLUDE_TESTS=ON" 15 + ]; 16 + 17 + extraPostPatch = '' 18 + # Looks like they forgot to add finding libedit to the standalone build 19 + ln -s ../cmake/Modules/FindLibEdit.cmake cmake/modules 20 + 21 + substituteInPlace CMakeLists.txt \ 22 + --replace "include(CheckIncludeFile)" "include(CheckIncludeFile)''\nfind_package(LibEdit)" 23 + 24 + # `No such file or directory: '/build/source/clang/tools/scan-build/bin/scan-build'` 25 + rm test/Analysis/scan-build/*.test 26 + rm test/Analysis/scan-build/rebuild_index/rebuild_index.test 27 + 28 + # `does not depend on a module exporting 'baz.h'` 29 + rm test/Modules/header-attribs.cpp 30 + 31 + # We do not have HIP or the ROCm stack available yet 32 + rm test/Driver/hip-options.hip 33 + 34 + # ???? `ld: cannot find crti.o: No such file or directory` linker issue? 35 + rm test/Interpreter/dynamic-library.cpp 36 + 37 + # `fatal error: 'stdio.h' file not found` 38 + rm test/OpenMP/amdgcn_emit_llvm.c 39 + ''; 40 + 41 + extraPostInstall = '' 42 + mv bin/clang-tblgen $out/bin 43 + ''; 44 + 45 + requiredSystemFeatures = [ "big-parallel" ]; 46 + }
+13
pkgs/development/rocm-modules/5/llvm/stage-1/lld.nix
··· 1 + { callPackage 2 + , rocmUpdateScript 3 + , llvm 4 + }: 5 + 6 + callPackage ../base.nix rec { 7 + inherit rocmUpdateScript; 8 + buildMan = false; # No man pages to build 9 + targetName = "lld"; 10 + targetDir = targetName; 11 + extraBuildInputs = [ llvm ]; 12 + checkTargets = [ "check-${targetName}" ]; 13 + }
+10
pkgs/development/rocm-modules/5/llvm/stage-1/llvm.nix
··· 1 + { stdenv 2 + , callPackage 3 + , rocmUpdateScript 4 + }: 5 + 6 + callPackage ../base.nix { 7 + inherit rocmUpdateScript; 8 + requiredSystemFeatures = [ "big-parallel" ]; 9 + isBroken = stdenv.isAarch64; # https://github.com/RadeonOpenCompute/ROCm/issues/1831#issuecomment-1278205344 10 + }
+30
pkgs/development/rocm-modules/5/llvm/stage-1/runtimes.nix
··· 1 + { lib 2 + , callPackage 3 + , rocmUpdateScript 4 + , llvm 5 + }: 6 + 7 + callPackage ../base.nix rec { 8 + inherit rocmUpdateScript; 9 + buildDocs = false; 10 + buildMan = false; 11 + buildTests = false; 12 + targetName = "runtimes"; 13 + targetDir = targetName; 14 + 15 + targetRuntimes = [ 16 + "libunwind" 17 + "libcxxabi" 18 + "libcxx" 19 + "compiler-rt" 20 + ]; 21 + 22 + extraBuildInputs = [ llvm ]; 23 + 24 + extraCMakeFlags = [ 25 + "-DLIBCXX_INCLUDE_BENCHMARKS=OFF" 26 + "-DLIBCXX_CXX_ABI=libcxxabi" 27 + ]; 28 + 29 + extraLicenses = [ lib.licenses.mit ]; 30 + }
+171
pkgs/development/rocm-modules/5/llvm/stage-2/1000-libcxx-failing-tests.list
··· 1 + ../libcxx/test/libcxx/containers/gnu_cxx/hash_map.pass.cpp 2 + ../libcxx/test/libcxx/containers/gnu_cxx/hash_set.pass.cpp 3 + ../libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.cxx2a.pass.cpp 4 + ../libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/construct.cxx2a.pass.cpp 5 + ../libcxx/test/libcxx/input.output/filesystems/class.directory_entry/directory_entry.mods/last_write_time.pass.cpp 6 + ../libcxx/test/libcxx/input.output/filesystems/class.path/path.member/path.native.obs/string_alloc.pass.cpp 7 + ../libcxx/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp 8 + ../libcxx/test/libcxx/localization/locales/locale/locale.types/locale.facet/no_allocation.pass.cpp 9 + ../libcxx/test/libcxx/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_from_underaligned_buffer.pass.cpp 10 + ../libcxx/test/libcxx/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_in_geometric_progression.pass.cpp 11 + ../libcxx/test/std/containers/associative/map/map.access/index_key.pass.cpp 12 + ../libcxx/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp 13 + ../libcxx/test/std/containers/associative/map/map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp 14 + ../libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_allocator_requirements.pass.cpp 15 + ../libcxx/test/std/containers/associative/multiset/insert_emplace_allocator_requirements.pass.cpp 16 + ../libcxx/test/std/containers/associative/set/insert_and_emplace_allocator_requirements.pass.cpp 17 + ../libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp 18 + ../libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp 19 + ../libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp 20 + ../libcxx/test/std/containers/sequences/vector.bool/ctor_exceptions.pass.cpp 21 + ../libcxx/test/std/containers/sequences/vector/vector.cons/exceptions.pass.cpp 22 + ../libcxx/test/std/containers/unord/unord.map/unord.map.elem/index.pass.cpp 23 + ../libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp 24 + ../libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_allocator_requirements.pass.cpp 25 + ../libcxx/test/std/containers/unord/unord.multiset/insert_emplace_allocator_requirements.pass.cpp 26 + ../libcxx/test/std/containers/unord/unord.set/insert_and_emplace_allocator_requirements.pass.cpp 27 + ../libcxx/test/std/experimental/memory/memory.resource.global/new_delete_resource.pass.cpp 28 + ../libcxx/test/std/experimental/memory/memory.resource.global/null_memory_resource.pass.cpp 29 + ../libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/pbackfail.pass.cpp 30 + ../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/copy_assign.pass.cpp 31 + ../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/copy.pass.cpp 32 + ../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/move_assign.pass.cpp 33 + ../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/move.pass.cpp 34 + ../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/path.pass.cpp 35 + ../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.mods/assign.pass.cpp 36 + ../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.mods/refresh.pass.cpp 37 + ../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.mods/replace_filename.pass.cpp 38 + ../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/file_size.pass.cpp 39 + ../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/file_type_obs.pass.cpp 40 + ../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/hard_link_count.pass.cpp 41 + ../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/last_write_time.pass.cpp 42 + ../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/status.pass.cpp 43 + ../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/symlink_status.pass.cpp 44 + ../libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp 45 + ../libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/copy.pass.cpp 46 + ../libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/ctor.pass.cpp 47 + ../libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/increment.pass.cpp 48 + ../libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp 49 + ../libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/move.pass.cpp 50 + ../libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp 51 + ../libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp 52 + ../libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/move.pass.cpp 53 + ../libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/source.pass.cpp 54 + ../libcxx/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp 55 + ../libcxx/test/std/input.output/filesystems/class.path/path.member/path.concat.pass.cpp 56 + ../libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/move.pass.cpp 57 + ../libcxx/test/std/input.output/filesystems/class.path/path.member/path.decompose/path.decompose.pass.cpp 58 + ../libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_normal.pass.cpp 59 + ../libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp 60 + ../libcxx/test/std/input.output/filesystems/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp 61 + ../libcxx/test/std/input.output/filesystems/class.path/path.member/path.generic.obs/named_overloads.pass.cpp 62 + ../libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/clear.pass.cpp 63 + ../libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/make_preferred.pass.cpp 64 + ../libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/remove_filename.pass.cpp 65 + ../libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_extension.pass.cpp 66 + ../libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_filename.pass.cpp 67 + ../libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/swap.pass.cpp 68 + ../libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/named_overloads.pass.cpp 69 + ../libcxx/test/std/input.output/filesystems/class.path/path.nonmember/path.factory.pass.cpp 70 + ../libcxx/test/std/input.output/filesystems/class.path/path.nonmember/path.io.pass.cpp 71 + ../libcxx/test/std/input.output/filesystems/class.path/path.nonmember/swap.pass.cpp 72 + ../libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp 73 + ../libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp 74 + ../libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp 75 + ../libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp 76 + ../libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp 77 + ../libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp 78 + ../libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp 79 + ../libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp 80 + ../libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp 81 + ../libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp 82 + ../libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp 83 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.canonical/canonical.pass.cpp 84 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp 85 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp 86 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp 87 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy/copy.pass.cpp 88 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp 89 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp 90 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp 91 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp 92 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp 93 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp 94 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.current_path/current_path.pass.cpp 95 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp 96 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.exists/exists.pass.cpp 97 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.file_size/file_size.pass.cpp 98 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp 99 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp 100 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp 101 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp 102 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp 103 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp 104 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_other/is_other.pass.cpp 105 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp 106 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp 107 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp 108 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp 109 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.permissions/permissions.pass.cpp 110 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp 111 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp 112 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.relative/relative.pass.cpp 113 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp 114 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove_all/toctou.pass.cpp 115 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove/remove.pass.cpp 116 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.rename/rename.pass.cpp 117 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp 118 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.space/space.pass.cpp 119 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.status/status.pass.cpp 120 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp 121 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp 122 + ../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp 123 + ../libcxx/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.dtor/dtor.pass.cpp 124 + ../libcxx/test/std/localization/locale.stdcvt/codecvt_utf16.pass.cpp 125 + ../libcxx/test/std/localization/locale.stdcvt/codecvt_utf8.pass.cpp 126 + ../libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp 127 + ../libcxx/test/std/localization/locales/locale/locale.members/combine.pass.cpp 128 + ../libcxx/test/std/strings/basic.string/string.cons/substr_rvalue.pass.cpp 129 + ../libcxx/test/std/utilities/any/any.class/any.assign/copy.pass.cpp 130 + ../libcxx/test/std/utilities/any/any.class/any.assign/value.pass.cpp 131 + ../libcxx/test/std/utilities/any/any.class/any.cons/copy.pass.cpp 132 + ../libcxx/test/std/utilities/any/any.class/any.cons/default.pass.cpp 133 + ../libcxx/test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp 134 + ../libcxx/test/std/utilities/any/any.class/any.cons/move.pass.cpp 135 + ../libcxx/test/std/utilities/any/any.class/any.cons/value.pass.cpp 136 + ../libcxx/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp 137 + ../libcxx/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp 138 + ../libcxx/test/std/utilities/any/any.nonmembers/make_any.pass.cpp 139 + ../libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp 140 + ../libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp 141 + ../libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp 142 + ../libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp 143 + ../libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp 144 + ../libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign.pass.cpp 145 + ../libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp 146 + ../libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate_at_least.pass.cpp 147 + ../libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp 148 + ../libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp 149 + ../libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp 150 + ../libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp 151 + ../libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp 152 + ../libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp 153 + ../libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp 154 + ../libcxx/test/std/utilities/utility/mem.res/mem.res.global/new_delete_resource.pass.cpp 155 + ../libcxx/test/std/utilities/utility/mem.res/mem.res.global/null_memory_resource.pass.cpp 156 + ../libcxx/test/std/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.ctor/without_buffer.pass.cpp 157 + ../libcxx/test/std/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_deallocate.pass.cpp 158 + ../libcxx/test/std/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_exception_safety.pass.cpp 159 + ../libcxx/test/std/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_from_initial_buffer.pass.cpp 160 + ../libcxx/test/std/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_from_zero_sized_buffer.pass.cpp 161 + ../libcxx/test/std/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_in_geometric_progression.pass.cpp 162 + ../libcxx/test/std/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_overaligned_request.pass.cpp 163 + ../libcxx/test/std/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_with_initial_size.pass.cpp 164 + ../libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.ctor/ctor_does_not_allocate.pass.cpp 165 + ../libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/equality.pass.cpp 166 + ../libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/sync_allocate_overaligned_request.pass.cpp 167 + ../libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/sync_allocate_reuse_blocks.pass.cpp 168 + ../libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/sync_allocate.pass.cpp 169 + ../libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/unsync_allocate_overaligned_request.pass.cpp 170 + ../libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/unsync_allocate_reuse_blocks.pass.cpp 171 + ../libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/unsync_allocate.pass.cpp
+28
pkgs/development/rocm-modules/5/llvm/stage-2/bintools-unwrapped.nix
··· 1 + { runCommand 2 + , llvm 3 + , lld 4 + }: 5 + 6 + runCommand "rocm-llvm-binutils-${llvm.version}" { preferLocalBuild = true; } '' 7 + mkdir -p $out/bin 8 + 9 + for prog in ${lld}/bin/*; do 10 + ln -s $prog $out/bin/$(basename $prog) 11 + done 12 + 13 + for prog in ${llvm}/bin/*; do 14 + ln -sf $prog $out/bin/$(basename $prog) 15 + done 16 + 17 + ln -s ${llvm}/bin/llvm-ar $out/bin/ar 18 + ln -s ${llvm}/bin/llvm-as $out/bin/as 19 + ln -s ${llvm}/bin/llvm-dwp $out/bin/dwp 20 + ln -s ${llvm}/bin/llvm-nm $out/bin/nm 21 + ln -s ${llvm}/bin/llvm-objcopy $out/bin/objcopy 22 + ln -s ${llvm}/bin/llvm-objdump $out/bin/objdump 23 + ln -s ${llvm}/bin/llvm-ranlib $out/bin/ranlib 24 + ln -s ${llvm}/bin/llvm-readelf $out/bin/readelf 25 + ln -s ${llvm}/bin/llvm-size $out/bin/size 26 + ln -s ${llvm}/bin/llvm-strip $out/bin/strip 27 + ln -s ${lld}/bin/lld $out/bin/ld 28 + ''
+63
pkgs/development/rocm-modules/5/llvm/stage-2/compiler-rt.nix
··· 1 + { lib 2 + , stdenv 3 + , callPackage 4 + , rocmUpdateScript 5 + , llvm 6 + , glibc 7 + }: 8 + 9 + callPackage ../base.nix rec { 10 + inherit stdenv rocmUpdateScript; 11 + buildDocs = false; # No documentation to build 12 + buildMan = false; # No man pages to build 13 + targetName = "compiler-rt"; 14 + targetDir = "runtimes"; 15 + 16 + targetRuntimes = [ 17 + "libunwind" 18 + "libcxxabi" 19 + "libcxx" 20 + targetName 21 + ]; 22 + 23 + extraCMakeFlags = [ 24 + "-DCOMPILER_RT_INCLUDE_TESTS=ON" 25 + "-DCOMPILER_RT_USE_LLVM_UNWINDER=ON" 26 + "-DCOMPILER_RT_CXX_LIBRARY=libcxx" 27 + "-DCOMPILER_RT_CAN_EXECUTE_TESTS=OFF" # We can't run most of these 28 + 29 + # Workaround having to build combined 30 + "-DLIBUNWIND_INCLUDE_DOCS=OFF" 31 + "-DLIBUNWIND_INCLUDE_TESTS=OFF" 32 + "-DLIBUNWIND_USE_COMPILER_RT=ON" 33 + "-DLIBUNWIND_INSTALL_LIBRARY=OFF" 34 + "-DLIBUNWIND_INSTALL_HEADERS=OFF" 35 + "-DLIBCXXABI_INCLUDE_TESTS=OFF" 36 + "-DLIBCXXABI_USE_LLVM_UNWINDER=ON" 37 + "-DLIBCXXABI_USE_COMPILER_RT=ON" 38 + "-DLIBCXXABI_INSTALL_LIBRARY=OFF" 39 + "-DLIBCXXABI_INSTALL_HEADERS=OFF" 40 + "-DLIBCXX_INCLUDE_DOCS=OFF" 41 + "-DLIBCXX_INCLUDE_TESTS=OFF" 42 + "-DLIBCXX_USE_COMPILER_RT=ON" 43 + "-DLIBCXX_CXX_ABI=libcxxabi" 44 + "-DLIBCXX_INSTALL_LIBRARY=OFF" 45 + "-DLIBCXX_INSTALL_HEADERS=OFF" 46 + ]; 47 + 48 + extraPostPatch = '' 49 + # `No such file or directory: 'ldd'` 50 + substituteInPlace ../compiler-rt/test/lit.common.cfg.py \ 51 + --replace "'ldd'," "'${glibc.bin}/bin/ldd'," 52 + 53 + # We can run these 54 + substituteInPlace ../compiler-rt/test/CMakeLists.txt \ 55 + --replace "endfunction()" "endfunction()''\nadd_subdirectory(builtins)''\nadd_subdirectory(shadowcallstack)" 56 + 57 + # Could not launch llvm-config in /build/source/runtimes/build/bin 58 + mkdir -p build/bin 59 + ln -s ${llvm}/bin/llvm-config build/bin 60 + ''; 61 + 62 + extraLicenses = [ lib.licenses.mit ]; 63 + }
+26
pkgs/development/rocm-modules/5/llvm/stage-2/libc.nix
··· 1 + { stdenv 2 + , callPackage 3 + , rocmUpdateScript 4 + }: 5 + 6 + callPackage ../base.nix rec { 7 + inherit stdenv rocmUpdateScript; 8 + buildMan = false; # No man pages to build 9 + targetName = "libc"; 10 + targetDir = "runtimes"; 11 + targetRuntimes = [ targetName ]; 12 + 13 + extraPostPatch = '' 14 + # `Failed to match ... against ...` `Match value not within tolerance value of MPFR result:` 15 + # We need a better way, but I don't know enough sed magic and patching `CMakeLists.txt` isn't working... 16 + substituteInPlace ../libc/test/src/math/log10_test.cpp \ 17 + --replace "i < N" "i < 0" \ 18 + --replace "test(mpfr::RoundingMode::Nearest);" "" \ 19 + --replace "test(mpfr::RoundingMode::Downward);" "" \ 20 + --replace "test(mpfr::RoundingMode::Upward);" "" \ 21 + --replace "test(mpfr::RoundingMode::TowardZero);" "" 22 + ''; 23 + 24 + checkTargets = [ "check-${targetName}" ]; 25 + hardeningDisable = [ "fortify" ]; # Prevent `error: "Assumed value of MB_LEN_MAX wrong"` 26 + }
+42
pkgs/development/rocm-modules/5/llvm/stage-2/libcxx.nix
··· 1 + { stdenv 2 + , callPackage 3 + , rocmUpdateScript 4 + }: 5 + 6 + callPackage ../base.nix rec { 7 + inherit stdenv rocmUpdateScript; 8 + buildMan = false; # No man pages to build 9 + targetName = "libcxx"; 10 + targetDir = "runtimes"; 11 + 12 + targetRuntimes = [ 13 + "libunwind" 14 + "libcxxabi" 15 + targetName 16 + ]; 17 + 18 + extraCMakeFlags = [ 19 + "-DLIBCXX_INCLUDE_DOCS=ON" 20 + "-DLIBCXX_INCLUDE_TESTS=ON" 21 + "-DLIBCXX_USE_COMPILER_RT=ON" 22 + "-DLIBCXX_CXX_ABI=libcxxabi" 23 + 24 + # Workaround having to build combined 25 + "-DLIBUNWIND_INCLUDE_DOCS=OFF" 26 + "-DLIBUNWIND_INCLUDE_TESTS=OFF" 27 + "-DLIBUNWIND_USE_COMPILER_RT=ON" 28 + "-DLIBUNWIND_INSTALL_LIBRARY=OFF" 29 + "-DLIBUNWIND_INSTALL_HEADERS=OFF" 30 + "-DLIBCXXABI_INCLUDE_TESTS=OFF" 31 + "-DLIBCXXABI_USE_LLVM_UNWINDER=ON" 32 + "-DLIBCXXABI_USE_COMPILER_RT=ON" 33 + "-DLIBCXXABI_INSTALL_LIBRARY=OFF" 34 + "-DLIBCXXABI_INSTALL_HEADERS=OFF" 35 + ]; 36 + 37 + # Most of these can't find `bash` or `mkdir`, might just be hard-coded paths, or PATH is altered 38 + extraPostPatch = '' 39 + chmod +w -R ../libcxx/test/{libcxx,std} 40 + cat ${./1000-libcxx-failing-tests.list} | xargs -d \\n rm 41 + ''; 42 + }
+37
pkgs/development/rocm-modules/5/llvm/stage-2/libcxxabi.nix
··· 1 + { stdenv 2 + , callPackage 3 + , rocmUpdateScript 4 + }: 5 + 6 + callPackage ../base.nix rec { 7 + inherit stdenv rocmUpdateScript; 8 + buildDocs = false; # No documentation to build 9 + buildMan = false; # No man pages to build 10 + targetName = "libcxxabi"; 11 + targetDir = "runtimes"; 12 + 13 + targetRuntimes = [ 14 + "libunwind" 15 + targetName 16 + "libcxx" 17 + ]; 18 + 19 + extraCMakeFlags = [ 20 + "-DLIBCXXABI_INCLUDE_TESTS=ON" 21 + "-DLIBCXXABI_USE_LLVM_UNWINDER=ON" 22 + "-DLIBCXXABI_USE_COMPILER_RT=ON" 23 + 24 + # Workaround having to build combined 25 + "-DLIBUNWIND_INCLUDE_DOCS=OFF" 26 + "-DLIBUNWIND_INCLUDE_TESTS=OFF" 27 + "-DLIBUNWIND_USE_COMPILER_RT=ON" 28 + "-DLIBUNWIND_INSTALL_LIBRARY=OFF" 29 + "-DLIBUNWIND_INSTALL_HEADERS=OFF" 30 + "-DLIBCXX_INCLUDE_DOCS=OFF" 31 + "-DLIBCXX_INCLUDE_TESTS=OFF" 32 + "-DLIBCXX_USE_COMPILER_RT=ON" 33 + "-DLIBCXX_CXX_ABI=libcxxabi" 34 + "-DLIBCXX_INSTALL_LIBRARY=OFF" 35 + "-DLIBCXX_INSTALL_HEADERS=OFF" 36 + ]; 37 + }
+26
pkgs/development/rocm-modules/5/llvm/stage-2/libunwind.nix
··· 1 + { stdenv 2 + , callPackage 3 + , rocmUpdateScript 4 + }: 5 + 6 + callPackage ../base.nix rec { 7 + inherit stdenv rocmUpdateScript; 8 + buildMan = false; # No man pages to build 9 + targetName = "libunwind"; 10 + targetDir = "runtimes"; 11 + targetRuntimes = [ targetName ]; 12 + 13 + extraCMakeFlags = [ 14 + "-DLIBUNWIND_INCLUDE_DOCS=ON" 15 + "-DLIBUNWIND_INCLUDE_TESTS=ON" 16 + "-DLIBUNWIND_USE_COMPILER_RT=ON" 17 + ]; 18 + 19 + extraPostPatch = '' 20 + # `command had no output on stdout or stderr` (Says these unsupported tests) 21 + chmod +w -R ../libunwind/test 22 + rm ../libunwind/test/floatregister.pass.cpp 23 + rm ../libunwind/test/unwind_leaffunction.pass.cpp 24 + rm ../libunwind/test/libunwind_02.pass.cpp 25 + ''; 26 + }
+35
pkgs/development/rocm-modules/5/llvm/stage-2/rstdenv.nix
··· 1 + { stdenv 2 + , overrideCC 3 + , wrapCCWith 4 + , llvm 5 + , clang-unwrapped 6 + , lld 7 + , runtimes 8 + , bintools 9 + }: 10 + 11 + overrideCC stdenv (wrapCCWith rec { 12 + inherit bintools; 13 + libcxx = runtimes; 14 + cc = clang-unwrapped; 15 + 16 + extraPackages = [ 17 + llvm 18 + lld 19 + ]; 20 + 21 + nixSupport.cc-cflags = [ 22 + "-resource-dir=$out/resource-root" 23 + "-fuse-ld=lld" 24 + "-rtlib=compiler-rt" 25 + "-unwindlib=libunwind" 26 + "-Wno-unused-command-line-argument" 27 + ]; 28 + 29 + extraBuildCommands = '' 30 + clang_version=`${cc}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"` 31 + mkdir -p $out/resource-root 32 + ln -s ${cc}/lib/clang/$clang_version/include $out/resource-root 33 + ln -s ${runtimes}/lib $out/resource-root 34 + ''; 35 + })
+36
pkgs/development/rocm-modules/5/llvm/stage-3/0000-mlir-fix-debugtranslation.patch
··· 1 + From f1d1e10ec7e1061bf0b90abbc1e298d9438a5e74 Mon Sep 17 00:00:00 2001 2 + From: Scott Linder <Scott.Linder@amd.com> 3 + Date: Mon, 11 Sep 2023 18:37:37 +0000 4 + Subject: [PATCH] [HeterogeneousDWARF] Update MLIR DI Metadata handling 5 + 6 + Pass a default DW_MSPACE_LLVM_none to satisfy new API 7 + 8 + Change-Id: I50df461f00b5510a715f55f61107122318102d22 9 + --- 10 + lib/Target/LLVMIR/DebugTranslation.cpp | 6 ++++-- 11 + 1 file changed, 4 insertions(+), 2 deletions(-) 12 + 13 + diff --git a/lib/Target/LLVMIR/DebugTranslation.cpp b/lib/Target/LLVMIR/DebugTranslation.cpp 14 + index 2053f5bcef06aa6..635ee5d7e5fefdc 100644 15 + --- a/lib/Target/LLVMIR/DebugTranslation.cpp 16 + +++ b/lib/Target/LLVMIR/DebugTranslation.cpp 17 + @@ -148,7 +148,8 @@ llvm::DIDerivedType *DebugTranslation::translateImpl(DIDerivedTypeAttr attr) { 18 + /*File=*/nullptr, /*Line=*/0, 19 + /*Scope=*/nullptr, translate(attr.getBaseType()), attr.getSizeInBits(), 20 + attr.getAlignInBits(), attr.getOffsetInBits(), 21 + - /*DWARFAddressSpace=*/std::nullopt, /*Flags=*/llvm::DINode::FlagZero); 22 + + /*DWARFAddressSpace=*/std::nullopt, llvm::dwarf::DW_MSPACE_LLVM_none, 23 + + /*Flags=*/llvm::DINode::FlagZero); 24 + } 25 + 26 + llvm::DIFile *DebugTranslation::translateImpl(DIFileAttr attr) { 27 + @@ -185,7 +186,8 @@ DebugTranslation::translateImpl(DILocalVariableAttr attr) { 28 + llvmCtx, translate(attr.getScope()), getMDStringOrNull(attr.getName()), 29 + translate(attr.getFile()), attr.getLine(), translate(attr.getType()), 30 + attr.getArg(), 31 + - /*Flags=*/llvm::DINode::FlagZero, attr.getAlignInBits(), 32 + + /*Flags=*/llvm::DINode::FlagZero, llvm::dwarf::DW_MSPACE_LLVM_none, 33 + + attr.getAlignInBits(), 34 + /*Annotations=*/nullptr); 35 + } 36 +
+122
pkgs/development/rocm-modules/5/llvm/stage-3/1000-openmp-failing-tests.list
··· 1 + runtime/test/tasking/hidden_helper_task/gtid.cpp 2 + runtime/test/ompt/parallel/parallel_if0.c 3 + runtime/test/ompt/parallel/serialized.c 4 + runtime/test/ompt/teams/parallel_team.c 5 + runtime/test/ompt/teams/serial_teams.c 6 + runtime/test/ompt/teams/serialized.c 7 + runtime/test/ompt/teams/team.c 8 + libomptarget/test/api/assert.c 9 + libomptarget/test/api/omp_device_managed_memory.c 10 + libomptarget/test/api/omp_device_memory.c 11 + libomptarget/test/api/omp_get_device_num.c 12 + libomptarget/test/api/omp_host_pinned_memory.c 13 + libomptarget/test/api/omp_host_pinned_memory_alloc.c 14 + libomptarget/test/api/omp_target_memcpy_async1.c 15 + libomptarget/test/api/omp_target_memcpy_async2.c 16 + libomptarget/test/api/omp_target_memcpy_rect_async1.c 17 + libomptarget/test/api/omp_target_memcpy_rect_async2.c 18 + libomptarget/test/mapping/array_section_implicit_capture.c 19 + libomptarget/test/mapping/data_absent_at_exit.c 20 + libomptarget/test/mapping/data_member_ref.cpp 21 + libomptarget/test/mapping/declare_mapper_api.cpp 22 + libomptarget/test/mapping/declare_mapper_target.cpp 23 + libomptarget/test/mapping/declare_mapper_target_data.cpp 24 + libomptarget/test/mapping/declare_mapper_target_data_enter_exit.cpp 25 + libomptarget/test/mapping/firstprivate_aligned.cpp 26 + libomptarget/test/mapping/has_device_addr.cpp 27 + libomptarget/test/mapping/implicit_device_ptr.c 28 + libomptarget/test/mapping/is_device_ptr.cpp 29 + libomptarget/test/mapping/lambda_mapping.cpp 30 + libomptarget/test/mapping/low_alignment.c 31 + libomptarget/test/mapping/map_back_race.cpp 32 + libomptarget/test/mapping/power_of_two_alignment.c 33 + libomptarget/test/mapping/pr38704.c 34 + libomptarget/test/mapping/prelock.cpp 35 + libomptarget/test/mapping/present/target_data_at_exit.c 36 + libomptarget/test/mapping/private_mapping.c 37 + libomptarget/test/mapping/ptr_and_obj_motion.c 38 + libomptarget/test/mapping/reduction_implicit_map.cpp 39 + libomptarget/test/mapping/target_derefence_array_pointrs.cpp 40 + libomptarget/test/mapping/target_map_for_member_data.cpp 41 + libomptarget/test/mapping/target_update_array_extension.c 42 + libomptarget/test/mapping/target_use_device_addr.c 43 + libomptarget/test/offloading/atomic-compare-signedness.c 44 + libomptarget/test/offloading/bug47654.cpp 45 + libomptarget/test/offloading/bug49021.cpp 46 + libomptarget/test/offloading/bug49779.cpp 47 + libomptarget/test/offloading/bug50022.cpp 48 + libomptarget/test/offloading/bug51781.c 49 + libomptarget/test/offloading/bug51982.c 50 + libomptarget/test/offloading/bug53727.cpp 51 + libomptarget/test/offloading/complex_reduction.cpp 52 + libomptarget/test/offloading/cuda_no_devices.c 53 + libomptarget/test/offloading/d2d_memcpy.c 54 + libomptarget/test/offloading/dynamic_module.c 55 + libomptarget/test/offloading/dynamic_module_load.c 56 + libomptarget/test/offloading/global_constructor.cpp 57 + libomptarget/test/offloading/lone_target_exit_data.c 58 + libomptarget/test/offloading/memory_manager.cpp 59 + libomptarget/test/offloading/parallel_offloading_map.cpp 60 + libomptarget/test/offloading/static_linking.c 61 + libomptarget/test/offloading/std_complex_arithmetic.cpp 62 + libomptarget/test/offloading/target-teams-atomic.c 63 + libomptarget/test/offloading/target_constexpr_mapping.cpp 64 + libomptarget/test/offloading/target_critical_region.cpp 65 + libomptarget/test/offloading/target_depend_nowait.cpp 66 + libomptarget/test/offloading/target_nowait_target.cpp 67 + libomptarget/test/offloading/taskloop_offload_nowait.cpp 68 + libomptarget/test/offloading/test_libc.cpp 69 + libomptarget/test/ompt/veccopy.c 70 + libomptarget/test/ompt/veccopy_disallow_both.c 71 + libomptarget/test/ompt/veccopy_emi.c 72 + libomptarget/test/ompt/veccopy_emi_map.c 73 + libomptarget/test/ompt/veccopy_map.c 74 + libomptarget/test/ompt/veccopy_no_device_init.c 75 + libomptarget/test/ompt/veccopy_wrong_return.c 76 + libomptarget/test/api/is_initial_device.c 77 + libomptarget/test/mapping/declare_mapper_nested_default_mappers_array_subscript.cpp 78 + libomptarget/test/mapping/declare_mapper_nested_default_mappers_ptr_subscript.cpp 79 + libomptarget/test/mapping/declare_mapper_nested_default_mappers_var.cpp 80 + libomptarget/test/mapping/target_pointers_members_map.cpp 81 + libomptarget/test/api/omp_dynamic_shared_memory_mixed.c 82 + libomptarget/test/api/omp_env_vars.c 83 + libomptarget/test/api/omp_get_mapped_ptr.c 84 + libomptarget/test/api/omp_get_num_devices.c 85 + libomptarget/test/api/omp_get_num_devices_with_empty_target.c 86 + libomptarget/test/mapping/alloc_fail.c 87 + libomptarget/test/mapping/array_section_use_device_ptr.c 88 + libomptarget/test/mapping/declare_mapper_nested_default_mappers.cpp 89 + libomptarget/test/mapping/declare_mapper_nested_mappers.cpp 90 + libomptarget/test/mapping/declare_mapper_target_update.cpp 91 + libomptarget/test/mapping/delete_inf_refcount.c 92 + libomptarget/test/mapping/lambda_by_value.cpp 93 + libomptarget/test/mapping/ompx_hold/omp_target_disassociate_ptr.c 94 + libomptarget/test/mapping/ompx_hold/struct.c 95 + libomptarget/test/mapping/ompx_hold/target-data.c 96 + libomptarget/test/mapping/ompx_hold/target.c 97 + libomptarget/test/mapping/present/target.c 98 + libomptarget/test/mapping/present/target_array_extension.c 99 + libomptarget/test/mapping/present/target_data.c 100 + libomptarget/test/mapping/present/target_data_array_extension.c 101 + libomptarget/test/mapping/present/target_enter_data.c 102 + libomptarget/test/mapping/present/target_exit_data_delete.c 103 + libomptarget/test/mapping/present/target_exit_data_release.c 104 + libomptarget/test/mapping/present/target_update.c 105 + libomptarget/test/mapping/present/target_update_array_extension.c 106 + libomptarget/test/mapping/present/zero_length_array_section.c 107 + libomptarget/test/mapping/present/zero_length_array_section_exit.c 108 + libomptarget/test/mapping/target_data_array_extension_at_exit.c 109 + libomptarget/test/mapping/target_has_device_addr.c 110 + libomptarget/test/mapping/target_implicit_partial_map.c 111 + libomptarget/test/mapping/target_wrong_use_device_addr.c 112 + libomptarget/test/offloading/host_as_target.c 113 + libomptarget/test/offloading/info.c 114 + libomptarget/test/offloading/offloading_success.c 115 + libomptarget/test/offloading/offloading_success.cpp 116 + libomptarget/test/offloading/wtime.c 117 + libomptarget/test/unified_shared_memory/api.c 118 + libomptarget/test/unified_shared_memory/associate_ptr.c 119 + libomptarget/test/unified_shared_memory/close_enter_exit.c 120 + libomptarget/test/unified_shared_memory/close_manual.c 121 + libomptarget/test/unified_shared_memory/close_member.c 122 + libomptarget/test/unified_shared_memory/close_modifier.c
+11
pkgs/development/rocm-modules/5/llvm/stage-3/1001-mlir-failing-tests.list
··· 1 + ./test/Target/LLVMIR/openmp-llvm.mlir 2 + ./test/mlir-spirv-cpu-runner/double.mlir 3 + ./test/mlir-spirv-cpu-runner/simple_add.mlir 4 + ./test/mlir-vulkan-runner/addf.mlir 5 + ./test/mlir-vulkan-runner/addi.mlir 6 + ./test/mlir-vulkan-runner/addi8.mlir 7 + ./test/mlir-vulkan-runner/mulf.mlir 8 + ./test/mlir-vulkan-runner/smul_extended.mlir 9 + ./test/mlir-vulkan-runner/subf.mlir 10 + ./test/mlir-vulkan-runner/time.mlir 11 + ./test/mlir-vulkan-runner/umul_extended.mlir
+42
pkgs/development/rocm-modules/5/llvm/stage-3/clang-tools-extra.nix
··· 1 + { stdenv 2 + , callPackage 3 + , rocmUpdateScript 4 + , llvm 5 + , clang-unwrapped 6 + , gtest 7 + }: 8 + 9 + callPackage ../base.nix rec { 10 + inherit stdenv rocmUpdateScript; 11 + buildTests = false; # `invalid operands to binary expression ('std::basic_stringstream<char>' and 'const llvm::StringRef')` 12 + targetName = "clang-tools-extra"; 13 + 14 + targetProjects = [ 15 + "clang" 16 + "clang-tools-extra" 17 + ]; 18 + 19 + extraBuildInputs = [ gtest ]; 20 + 21 + extraCMakeFlags = [ 22 + "-DLLVM_INCLUDE_DOCS=OFF" 23 + "-DLLVM_INCLUDE_TESTS=OFF" 24 + "-DCLANG_INCLUDE_DOCS=OFF" 25 + "-DCLANG_INCLUDE_TESTS=ON" 26 + "-DCLANG_TOOLS_EXTRA_INCLUDE_DOCS=ON" 27 + ]; 28 + 29 + extraPostInstall = '' 30 + # Remove LLVM and Clang 31 + for path in `find ${llvm} ${clang-unwrapped}`; do 32 + if [ $path != ${llvm} ] && [ $path != ${clang-unwrapped} ]; then 33 + rm -f $out''${path#${llvm}} $out''${path#${clang-unwrapped}} || true 34 + fi 35 + done 36 + 37 + # Cleanup empty directories 38 + find $out -type d -empty -delete 39 + ''; 40 + 41 + requiredSystemFeatures = [ "big-parallel" ]; 42 + }
+73
pkgs/development/rocm-modules/5/llvm/stage-3/clang.nix
··· 1 + { stdenv 2 + , wrapCCWith 3 + , llvm 4 + , lld 5 + , clang-unwrapped 6 + , bintools 7 + , libc 8 + , libunwind 9 + , libcxxabi 10 + , libcxx 11 + , compiler-rt 12 + }: 13 + 14 + wrapCCWith rec { 15 + inherit libcxx bintools; 16 + 17 + # We do this to avoid HIP pathing problems, and mimic a monolithic install 18 + cc = stdenv.mkDerivation (finalAttrs: { 19 + inherit (clang-unwrapped) version; 20 + pname = "rocm-llvm-clang"; 21 + dontUnpack = true; 22 + 23 + installPhase = '' 24 + runHook preInstall 25 + 26 + clang_version=`${clang-unwrapped}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"` 27 + mkdir -p $out/{bin,include/c++/v1,lib/{cmake,clang/$clang_version/{include,lib}},libexec,share} 28 + 29 + for path in ${llvm} ${clang-unwrapped} ${lld} ${libc} ${libunwind} ${libcxxabi} ${libcxx} ${compiler-rt}; do 30 + cp -as $path/* $out 31 + chmod +w $out/{*,include/c++/v1,lib/{clang/$clang_version/include,cmake}} 32 + rm -f $out/lib/libc++.so 33 + done 34 + 35 + ln -s $out/lib/* $out/lib/clang/$clang_version/lib 36 + ln -sf $out/include/* $out/lib/clang/$clang_version/include 37 + 38 + runHook postInstall 39 + ''; 40 + 41 + passthru.isClang = true; 42 + }); 43 + 44 + extraPackages = [ 45 + llvm 46 + lld 47 + libc 48 + libunwind 49 + libcxxabi 50 + compiler-rt 51 + ]; 52 + 53 + nixSupport.cc-cflags = [ 54 + "-resource-dir=$out/resource-root" 55 + "-fuse-ld=lld" 56 + "-rtlib=compiler-rt" 57 + "-unwindlib=libunwind" 58 + "-Wno-unused-command-line-argument" 59 + ]; 60 + 61 + extraBuildCommands = '' 62 + clang_version=`${cc}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"` 63 + mkdir -p $out/resource-root 64 + ln -s ${cc}/lib/clang/$clang_version/{include,lib} $out/resource-root 65 + 66 + # Not sure why, but hardening seems to make things break 67 + echo "" > $out/nix-support/add-hardening.sh 68 + 69 + # GPU compilation uses builtin `lld` 70 + substituteInPlace $out/bin/{clang,clang++} \ 71 + --replace "-MM) dontLink=1 ;;" "-MM | --cuda-device-only) dontLink=1 ;;''\n--cuda-host-only | --cuda-compile-host-device) dontLink=0 ;;" 72 + ''; 73 + }
+31
pkgs/development/rocm-modules/5/llvm/stage-3/flang.nix
··· 1 + { stdenv 2 + , callPackage 3 + , rocmUpdateScript 4 + , clang-unwrapped 5 + , mlir 6 + , graphviz 7 + , python3Packages 8 + }: 9 + 10 + callPackage ../base.nix rec { 11 + inherit stdenv rocmUpdateScript; 12 + targetName = "flang"; 13 + targetDir = targetName; 14 + 15 + extraNativeBuildInputs = [ 16 + graphviz 17 + python3Packages.sphinx-markdown-tables 18 + ]; 19 + 20 + extraBuildInputs = [ mlir ]; 21 + 22 + extraCMakeFlags = [ 23 + "-DCLANG_DIR=${clang-unwrapped}/lib/cmake/clang" 24 + "-DMLIR_TABLEGEN_EXE=${mlir}/bin/mlir-tblgen" 25 + "-DCLANG_TABLEGEN_EXE=${clang-unwrapped}/bin/clang-tblgen" 26 + "-DFLANG_INCLUDE_TESTS=OFF" # `The dependency target "Bye" of target ...` 27 + ]; 28 + 29 + # `flang/lib/Semantics/check-omp-structure.cpp:1905:1: error: no member named 'v' in 'Fortran::parser::OmpClause::OmpxDynCgroupMem'` 30 + isBroken = true; 31 + }
+36
pkgs/development/rocm-modules/5/llvm/stage-3/libclc.nix
··· 1 + { stdenv 2 + , callPackage 3 + , rocmUpdateScript 4 + , llvm 5 + , clang 6 + , spirv-llvm-translator 7 + }: 8 + 9 + let 10 + spirv = (spirv-llvm-translator.override { inherit llvm; }); 11 + in callPackage ../base.nix rec { 12 + inherit stdenv rocmUpdateScript; 13 + buildDocs = false; # No documentation to build 14 + buildMan = false; # No man pages to build 15 + targetName = "libclc"; 16 + targetDir = targetName; 17 + extraBuildInputs = [ spirv ]; 18 + 19 + # `spirv-mesa3d` isn't compiling with LLVM 15.0.0, it does with LLVM 14.0.0 20 + # Try removing the `spirv-mesa3d` and `clspv` patches next update 21 + # `clspv` tests fail, unresolved calls 22 + extraPostPatch = '' 23 + substituteInPlace CMakeLists.txt \ 24 + --replace "find_program( LLVM_CLANG clang PATHS \''${LLVM_BINDIR} NO_DEFAULT_PATH )" \ 25 + "find_program( LLVM_CLANG clang PATHS \"${clang}/bin\" NO_DEFAULT_PATH )" \ 26 + --replace "find_program( LLVM_SPIRV llvm-spirv PATHS \''${LLVM_BINDIR} NO_DEFAULT_PATH )" \ 27 + "find_program( LLVM_SPIRV llvm-spirv PATHS \"${spirv}/bin\" NO_DEFAULT_PATH )" \ 28 + --replace " spirv-mesa3d-" "" \ 29 + --replace " spirv64-mesa3d-" "" \ 30 + --replace "NOT \''${t} MATCHES" \ 31 + "NOT \''${ARCH} STREQUAL \"clspv\" AND NOT \''${ARCH} STREQUAL \"clspv64\" AND NOT \''${t} MATCHES" 32 + ''; 33 + 34 + checkTargets = [ ]; 35 + isBroken = true; # ROCm 5.7.0 doesn't have IR/AttributeMask.h yet...? 36 + }
+39
pkgs/development/rocm-modules/5/llvm/stage-3/lldb.nix
··· 1 + { stdenv 2 + , callPackage 3 + , rocmUpdateScript 4 + , clang 5 + , xz 6 + , swig 7 + , lua5_3 8 + , graphviz 9 + , gtest 10 + , python3Packages 11 + }: 12 + 13 + callPackage ../base.nix rec { 14 + inherit stdenv rocmUpdateScript; 15 + buildTests = false; # FIXME: Bad pathing for clang executable in tests, using relative path most likely 16 + targetName = "lldb"; 17 + targetDir = targetName; 18 + extraNativeBuildInputs = [ python3Packages.sphinx-automodapi ]; 19 + 20 + extraBuildInputs = [ 21 + xz 22 + swig 23 + lua5_3 24 + graphviz 25 + gtest 26 + ]; 27 + 28 + extraCMakeFlags = [ 29 + "-DLLDB_EXTERNAL_CLANG_RESOURCE_DIR=${clang}/resource-root/lib/clang/$clang_version" 30 + "-DLLDB_INCLUDE_TESTS=ON" 31 + "-DLLDB_INCLUDE_UNITTESTS=ON" 32 + ]; 33 + 34 + extraPostPatch = '' 35 + export clang_version=`clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"` 36 + ''; 37 + 38 + checkTargets = [ "check-${targetName}" ]; 39 + }
+57
pkgs/development/rocm-modules/5/llvm/stage-3/mlir.nix
··· 1 + { stdenv 2 + , callPackage 3 + , rocmUpdateScript 4 + , clr 5 + , vulkan-headers 6 + , vulkan-loader 7 + , glslang 8 + , shaderc 9 + , lit 10 + }: 11 + 12 + callPackage ../base.nix rec { 13 + inherit stdenv rocmUpdateScript; 14 + buildDocs = false; # No decent way to hack this to work 15 + buildMan = false; # No man pages to build 16 + targetName = "mlir"; 17 + targetDir = targetName; 18 + 19 + # Fix `DebugTranslation.cpp:139:10: error: no matching function for call to 'get'` 20 + # We patch at a different source root, so we modify the patch and include it locally 21 + # https://github.com/RadeonOpenCompute/llvm-project/commit/f1d1e10ec7e1061bf0b90abbc1e298d9438a5e74.patch 22 + extraPatches = [ ./0000-mlir-fix-debugtranslation.patch ]; 23 + extraNativeBuildInputs = [ clr ]; 24 + 25 + extraBuildInputs = [ 26 + vulkan-headers 27 + vulkan-loader 28 + glslang 29 + shaderc 30 + ]; 31 + 32 + extraCMakeFlags = [ 33 + "-DMLIR_INCLUDE_DOCS=ON" 34 + "-DMLIR_INCLUDE_TESTS=ON" 35 + "-DMLIR_ENABLE_ROCM_RUNNER=ON" 36 + "-DMLIR_ENABLE_SPIRV_CPU_RUNNER=ON" 37 + "-DMLIR_ENABLE_VULKAN_RUNNER=ON" 38 + "-DROCM_TEST_CHIPSET=gfx000" # CPU runner 39 + ]; 40 + 41 + extraPostPatch = '' 42 + # `add_library cannot create target "llvm_gtest" because an imported target with the same name already exists` 43 + substituteInPlace CMakeLists.txt \ 44 + --replace "EXISTS \''${UNITTEST_DIR}/googletest/include/gtest/gtest.h" "FALSE" 45 + 46 + # Mainly `No such file or directory` 47 + cat ${./1001-mlir-failing-tests.list} | xargs -d \\n rm 48 + ''; 49 + 50 + extraPostInstall = '' 51 + mkdir -p $out/bin 52 + mv bin/mlir-tblgen $out/bin 53 + ''; 54 + 55 + checkTargets = [ "check-${targetName}" ]; 56 + requiredSystemFeatures = [ "big-parallel" ]; 57 + }
+54
pkgs/development/rocm-modules/5/llvm/stage-3/openmp.nix
··· 1 + { lib 2 + , stdenv 3 + , callPackage 4 + , rocmUpdateScript 5 + , llvm 6 + , clang 7 + , clang-unwrapped 8 + , rocm-device-libs 9 + , rocm-runtime 10 + , rocm-thunk 11 + , perl 12 + , elfutils 13 + , libdrm 14 + , numactl 15 + , lit 16 + }: 17 + 18 + callPackage ../base.nix rec { 19 + inherit stdenv rocmUpdateScript; 20 + targetName = "openmp"; 21 + targetDir = targetName; 22 + extraNativeBuildInputs = [ perl ]; 23 + 24 + extraBuildInputs = [ 25 + rocm-device-libs 26 + rocm-runtime 27 + rocm-thunk 28 + elfutils 29 + libdrm 30 + numactl 31 + ]; 32 + 33 + extraCMakeFlags = [ 34 + "-DCMAKE_MODULE_PATH=/build/source/llvm/cmake/modules" # For docs 35 + "-DCLANG_TOOL=${clang}/bin/clang" 36 + "-DCLANG_OFFLOAD_BUNDLER_TOOL=${clang-unwrapped}/bin/clang-offload-bundler" 37 + "-DPACKAGER_TOOL=${clang-unwrapped}/bin/clang-offload-packager" 38 + "-DOPENMP_LLVM_TOOLS_DIR=${llvm}/bin" 39 + "-DOPENMP_LLVM_LIT_EXECUTABLE=${lit}/bin/.lit-wrapped" 40 + "-DDEVICELIBS_ROOT=${rocm-device-libs.src}" 41 + ]; 42 + 43 + extraPostPatch = '' 44 + # We can't build this target at the moment 45 + substituteInPlace libomptarget/DeviceRTL/CMakeLists.txt \ 46 + --replace "gfx1010" "" 47 + 48 + # No idea what's going on here... 49 + cat ${./1000-openmp-failing-tests.list} | xargs -d \\n rm 50 + ''; 51 + 52 + checkTargets = [ "check-${targetName}" ]; 53 + extraLicenses = [ lib.licenses.mit ]; 54 + }
+18
pkgs/development/rocm-modules/5/llvm/stage-3/polly.nix
··· 1 + { stdenv 2 + , callPackage 3 + , rocmUpdateScript 4 + }: 5 + 6 + callPackage ../base.nix rec { 7 + inherit stdenv rocmUpdateScript; 8 + targetName = "polly"; 9 + targetDir = targetName; 10 + 11 + extraPostPatch = '' 12 + # `add_library cannot create target "llvm_gtest" because an imported target with the same name already exists` 13 + substituteInPlace CMakeLists.txt \ 14 + --replace "NOT TARGET gtest" "FALSE" 15 + ''; 16 + 17 + checkTargets = [ "check-${targetName}" ]; 18 + }
+15
pkgs/development/rocm-modules/5/llvm/stage-3/pstl.nix
··· 1 + { stdenv 2 + , callPackage 3 + , rocmUpdateScript 4 + }: 5 + 6 + callPackage ../base.nix rec { 7 + inherit stdenv rocmUpdateScript; 8 + buildDocs = false; # No documentation to build 9 + buildMan = false; # No man pages to build 10 + buildTests = false; # Too many errors 11 + targetName = "pstl"; 12 + targetDir = "runtimes"; 13 + targetRuntimes = [ targetName ]; 14 + checkTargets = [ "check-${targetName}" ]; 15 + }
+240
pkgs/development/rocm-modules/5/miopen/default.nix
··· 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , fetchpatch 5 + , rocmUpdateScript 6 + , runCommand 7 + , pkg-config 8 + , cmake 9 + , rocm-cmake 10 + , rocblas 11 + , rocmlir 12 + , clr 13 + , clang-tools-extra 14 + , clang-ocl 15 + , miopengemm 16 + , composable_kernel 17 + , frugally-deep 18 + , rocm-docs-core 19 + , half 20 + , boost 21 + , sqlite 22 + , bzip2 23 + , lbzip2 24 + , nlohmann_json 25 + , texlive 26 + , doxygen 27 + , sphinx 28 + , zlib 29 + , gtest 30 + , rocm-comgr 31 + , python3Packages 32 + , buildDocs ? false # Needs internet because of rocm-docs-core 33 + , buildTests ? false 34 + , useOpenCL ? false 35 + }: 36 + 37 + let 38 + version = "5.7.0"; 39 + 40 + src = fetchFromGitHub { 41 + owner = "ROCmSoftwarePlatform"; 42 + repo = "MIOpen"; 43 + rev = "rocm-${version}"; 44 + hash = "sha256-xcKmFI8HcRA9bbh6EQGElKykIQ3RJX/q5f4IxXvM1Is="; 45 + fetchLFS = true; 46 + leaveDotGit = true; 47 + 48 + # If you're reading this, it's gonna take a bit of time. 49 + # fetchSubModules doesn't work with postFetch??? 50 + # fetchLFS isn't actually fetching the LFS files... 51 + postFetch = '' 52 + export HOME=$(mktemp -d) 53 + cd $out 54 + 55 + # We need more history to fetch LFS files 56 + git remote add origin $url 57 + git fetch origin 58 + git clean -fdx 59 + git checkout rocm-${version} 60 + 61 + # We need to do this manually since using leaveDotGit and fetchSubmodules errors 62 + git submodule update --init 63 + 64 + # Fetch the LFS files 65 + git lfs install 66 + git lfs fetch --all 67 + git lfs checkout 68 + 69 + # Remove the defunct .git folder 70 + rm -rf .git 71 + ''; 72 + }; 73 + 74 + latex = lib.optionalAttrs buildDocs texlive.combine { 75 + inherit (texlive) scheme-small 76 + latexmk 77 + tex-gyre 78 + fncychap 79 + wrapfig 80 + capt-of 81 + framed 82 + needspace 83 + tabulary 84 + varwidth 85 + titlesec; 86 + }; 87 + 88 + gfx900 = runCommand "miopen-gfx900.kdb" { preferLocalBuild = true; } '' 89 + ${lbzip2}/bin/lbzip2 -ckd ${src}/src/kernels/gfx900.kdb.bz2 > $out 90 + ''; 91 + 92 + gfx906 = runCommand "miopen-gfx906.kdb" { preferLocalBuild = true; } '' 93 + ${lbzip2}/bin/lbzip2 -ckd ${src}/src/kernels/gfx906.kdb.bz2 > $out 94 + ''; 95 + 96 + gfx908 = runCommand "miopen-gfx908.kdb" { preferLocalBuild = true; } '' 97 + ${lbzip2}/bin/lbzip2 -ckd ${src}/src/kernels/gfx908.kdb.bz2 > $out 98 + ''; 99 + 100 + gfx90a = runCommand "miopen-gfx90a.kdb" { preferLocalBuild = true; } '' 101 + ${lbzip2}/bin/lbzip2 -ckd ${src}/src/kernels/gfx90a.kdb.bz2 > $out 102 + ''; 103 + 104 + gfx1030 = runCommand "miopen-gfx1030.kdb" { preferLocalBuild = true; } '' 105 + ${lbzip2}/bin/lbzip2 -ckd ${src}/src/kernels/gfx1030.kdb.bz2 > $out 106 + ''; 107 + in stdenv.mkDerivation (finalAttrs: { 108 + inherit version src; 109 + pname = "miopen"; 110 + 111 + # Find zstd and add to target. Mainly for torch. 112 + patches = [ 113 + (fetchpatch { 114 + url = "https://github.com/ROCmSoftwarePlatform/MIOpen/commit/e608b4325646afeabb5e52846997b926d2019d19.patch"; 115 + hash = "sha256-oxa3qlIC2bzbwGxrQOZXoY/S7CpLsMrnWRB7Og0tk0M="; 116 + }) 117 + (fetchpatch { 118 + url = "https://github.com/ROCmSoftwarePlatform/MIOpen/commit/3413d2daaeb44b7d6eadcc03033a5954a118491e.patch"; 119 + hash = "sha256-ST4snUcTmmSI1Ogx815KEX9GdMnmubsavDzXCGJkiKs="; 120 + }) 121 + ]; 122 + 123 + outputs = [ 124 + "out" 125 + ] ++ lib.optionals buildDocs [ 126 + "doc" 127 + ] ++ lib.optionals buildTests [ 128 + "test" 129 + ]; 130 + 131 + nativeBuildInputs = [ 132 + pkg-config 133 + cmake 134 + rocm-cmake 135 + clr 136 + clang-tools-extra 137 + ]; 138 + 139 + buildInputs = [ 140 + rocblas 141 + rocmlir 142 + clang-ocl 143 + miopengemm 144 + composable_kernel 145 + half 146 + boost 147 + sqlite 148 + bzip2 149 + nlohmann_json 150 + frugally-deep 151 + ] ++ lib.optionals buildDocs [ 152 + latex 153 + doxygen 154 + sphinx 155 + rocm-docs-core 156 + python3Packages.sphinx-rtd-theme 157 + python3Packages.breathe 158 + python3Packages.myst-parser 159 + ] ++ lib.optionals buildTests [ 160 + zlib 161 + ]; 162 + 163 + cmakeFlags = [ 164 + "-DCMAKE_CXX_FLAGS=-Wno-#warnings" # <half> -> <half/half.hpp> 165 + "-DMIOPEN_USE_MIOPENGEMM=ON" 166 + "-DUNZIPPER=${bzip2}/bin/bunzip2" 167 + # Manually define CMAKE_INSTALL_<DIR> 168 + # See: https://github.com/NixOS/nixpkgs/pull/197838 169 + "-DCMAKE_INSTALL_BINDIR=bin" 170 + "-DCMAKE_INSTALL_LIBDIR=lib" 171 + "-DCMAKE_INSTALL_INCLUDEDIR=include" 172 + ] ++ lib.optionals (!useOpenCL) [ 173 + "-DCMAKE_C_COMPILER=hipcc" 174 + "-DCMAKE_CXX_COMPILER=hipcc" 175 + "-DMIOPEN_BACKEND=HIP" 176 + ] ++ lib.optionals useOpenCL [ 177 + "-DMIOPEN_BACKEND=OpenCL" 178 + ] ++ lib.optionals buildTests [ 179 + "-DBUILD_TESTS=ON" 180 + "-DMIOPEN_TEST_ALL=ON" 181 + ]; 182 + 183 + postPatch = '' 184 + patchShebangs test src/composable_kernel fin utils install_deps.cmake 185 + 186 + substituteInPlace CMakeLists.txt \ 187 + --replace "unpack_db(\"\''${CMAKE_SOURCE_DIR}/src/kernels/\''${FILE_NAME}.kdb.bz2\")" "" \ 188 + --replace "MIOPEN_HIP_COMPILER MATCHES \".*clang\\\\+\\\\+$\"" "true" \ 189 + --replace "set(MIOPEN_TIDY_ERRORS ALL)" "" # error: missing required key 'key' 190 + 191 + substituteInPlace test/gtest/CMakeLists.txt \ 192 + --replace "include(googletest)" "" 193 + 194 + ln -sf ${gfx900} src/kernels/gfx900.kdb 195 + ln -sf ${gfx906} src/kernels/gfx906.kdb 196 + ln -sf ${gfx908} src/kernels/gfx908.kdb 197 + ln -sf ${gfx90a} src/kernels/gfx90a.kdb 198 + ln -sf ${gfx1030} src/kernels/gfx1030.kdb 199 + ''; 200 + 201 + # Unfortunately, it seems like we have to call make on these manually 202 + postBuild = lib.optionalString buildDocs '' 203 + python -m sphinx -T -E -b html -d _build/doctrees -D language=en ../docs _build/html 204 + '' + lib.optionalString buildTests '' 205 + make -j$NIX_BUILD_CORES check 206 + ''; 207 + 208 + postInstall = '' 209 + rm $out/bin/install_precompiled_kernels.sh 210 + ln -sf ${gfx900} $out/share/miopen/db/gfx900.kdb 211 + ln -sf ${gfx906} $out/share/miopen/db/gfx906.kdb 212 + ln -sf ${gfx908} $out/share/miopen/db/gfx908.kdb 213 + ln -sf ${gfx90a} $out/share/miopen/db/gfx90a.kdb 214 + ln -sf ${gfx1030} $out/share/miopen/db/gfx1030.kdb 215 + '' + lib.optionalString buildDocs '' 216 + mv ../doc/html $out/share/doc/miopen-${if useOpenCL then "opencl" else "hip"} 217 + '' + lib.optionalString buildTests '' 218 + mkdir -p $test/bin 219 + mv bin/test_* $test/bin 220 + patchelf --set-rpath $out/lib:${lib.makeLibraryPath (finalAttrs.buildInputs ++ 221 + [ clr rocm-comgr ])} $test/bin/* 222 + ''; 223 + 224 + requiredSystemFeatures = [ "big-parallel" ]; 225 + 226 + passthru.updateScript = rocmUpdateScript { 227 + name = finalAttrs.pname; 228 + owner = finalAttrs.src.owner; 229 + repo = finalAttrs.src.repo; 230 + }; 231 + 232 + meta = with lib; { 233 + description = "Machine intelligence library for ROCm"; 234 + homepage = "https://github.com/ROCmSoftwarePlatform/MIOpen"; 235 + license = with licenses; [ mit ]; 236 + maintainers = teams.rocm.members; 237 + platforms = platforms.linux; 238 + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 239 + }; 240 + })
+200
pkgs/development/rocm-modules/5/rocblas/default.nix
··· 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , rocmUpdateScript 5 + , runCommand 6 + , cmake 7 + , rocm-cmake 8 + , clr 9 + , python3 10 + , tensile 11 + , msgpack 12 + , libxml2 13 + , gtest 14 + , gfortran 15 + , openmp 16 + , amd-blis 17 + , python3Packages 18 + , buildTensile ? true 19 + , buildTests ? false 20 + , buildBenchmarks ? false 21 + , tensileLogic ? "asm_full" 22 + , tensileCOVersion ? "default" 23 + , tensileSepArch ? true 24 + , tensileLazyLib ? true 25 + , tensileLibFormat ? "msgpack" 26 + , gpuTargets ? [ "all" ] 27 + }: 28 + let 29 + rocblas = stdenv.mkDerivation (finalAttrs: { 30 + pname = "rocblas"; 31 + version = "5.7.0"; 32 + 33 + outputs = [ 34 + "out" 35 + ] ++ lib.optionals buildTests [ 36 + "test" 37 + ] ++ lib.optionals buildBenchmarks [ 38 + "benchmark" 39 + ]; 40 + 41 + src = fetchFromGitHub { 42 + owner = "ROCmSoftwarePlatform"; 43 + repo = "rocBLAS"; 44 + rev = "rocm-${finalAttrs.version}"; 45 + hash = "sha256-3wKnwvAra8u9xqlC05wUD+gSoBILTVJFU2cIV6xv3Lk="; 46 + }; 47 + 48 + nativeBuildInputs = [ 49 + cmake 50 + rocm-cmake 51 + clr 52 + ]; 53 + 54 + buildInputs = [ 55 + python3 56 + ] ++ lib.optionals buildTensile [ 57 + msgpack 58 + libxml2 59 + python3Packages.msgpack 60 + python3Packages.joblib 61 + ] ++ lib.optionals buildTests [ 62 + gtest 63 + ] ++ lib.optionals (buildTests || buildBenchmarks) [ 64 + gfortran 65 + openmp 66 + amd-blis 67 + ] ++ lib.optionals (buildTensile || buildTests || buildBenchmarks) [ 68 + python3Packages.pyyaml 69 + ]; 70 + 71 + cmakeFlags = [ 72 + "-DCMAKE_C_COMPILER=hipcc" 73 + "-DCMAKE_CXX_COMPILER=hipcc" 74 + "-Dpython=python3" 75 + "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" 76 + "-DBUILD_WITH_TENSILE=${if buildTensile then "ON" else "OFF"}" 77 + # Manually define CMAKE_INSTALL_<DIR> 78 + # See: https://github.com/NixOS/nixpkgs/pull/197838 79 + "-DCMAKE_INSTALL_BINDIR=bin" 80 + "-DCMAKE_INSTALL_LIBDIR=lib" 81 + "-DCMAKE_INSTALL_INCLUDEDIR=include" 82 + ] ++ lib.optionals buildTensile [ 83 + "-DVIRTUALENV_HOME_DIR=/build/source/tensile" 84 + "-DTensile_TEST_LOCAL_PATH=/build/source/tensile" 85 + "-DTensile_ROOT=/build/source/tensile/lib/python${python3.pythonVersion}/site-packages/Tensile" 86 + "-DTensile_LOGIC=${tensileLogic}" 87 + "-DTensile_CODE_OBJECT_VERSION=${tensileCOVersion}" 88 + "-DTensile_SEPARATE_ARCHITECTURES=${if tensileSepArch then "ON" else "OFF"}" 89 + "-DTensile_LAZY_LIBRARY_LOADING=${if tensileLazyLib then "ON" else "OFF"}" 90 + "-DTensile_LIBRARY_FORMAT=${tensileLibFormat}" 91 + ] ++ lib.optionals buildTests [ 92 + "-DBUILD_CLIENTS_TESTS=ON" 93 + ] ++ lib.optionals buildBenchmarks [ 94 + "-DBUILD_CLIENTS_BENCHMARKS=ON" 95 + ] ++ lib.optionals (buildTests || buildBenchmarks) [ 96 + "-DCMAKE_CXX_FLAGS=-I${amd-blis}/include/blis" 97 + ]; 98 + 99 + # Tensile REALLY wants to write to the nix directory if we include it normally 100 + postPatch = lib.optionalString buildTensile '' 101 + cp -a ${tensile} tensile 102 + chmod +w -R tensile 103 + 104 + # Rewrap Tensile 105 + substituteInPlace tensile/bin/{.t*,.T*,*} \ 106 + --replace "${tensile}" "/build/source/tensile" 107 + 108 + substituteInPlace CMakeLists.txt \ 109 + --replace "include(virtualenv)" "" \ 110 + --replace "virtualenv_install(\''${Tensile_TEST_LOCAL_PATH})" "" 111 + ''; 112 + 113 + postInstall = lib.optionalString buildTests '' 114 + mkdir -p $test/bin 115 + cp -a $out/bin/* $test/bin 116 + rm $test/bin/*-bench || true 117 + '' + lib.optionalString buildBenchmarks '' 118 + mkdir -p $benchmark/bin 119 + cp -a $out/bin/* $benchmark/bin 120 + rm $benchmark/bin/*-test || true 121 + '' + lib.optionalString (buildTests || buildBenchmarks ) '' 122 + rm -rf $out/bin 123 + ''; 124 + 125 + passthru.updateScript = rocmUpdateScript { 126 + name = finalAttrs.pname; 127 + owner = finalAttrs.src.owner; 128 + repo = finalAttrs.src.repo; 129 + }; 130 + 131 + requiredSystemFeatures = [ "big-parallel" ]; 132 + 133 + meta = with lib; { 134 + description = "BLAS implementation for ROCm platform"; 135 + homepage = "https://github.com/ROCmSoftwarePlatform/rocBLAS"; 136 + license = with licenses; [ mit ]; 137 + maintainers = teams.rocm.members; 138 + platforms = platforms.linux; 139 + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 140 + }; 141 + }); 142 + 143 + gfx80 = runCommand "rocblas-gfx80" { preferLocalBuild = true; } '' 144 + mkdir -p $out/lib/rocblas/library 145 + cp -a ${rocblas}/lib/rocblas/library/*gfx80* $out/lib/rocblas/library 146 + ''; 147 + 148 + gfx90 = runCommand "rocblas-gfx90" { preferLocalBuild = true; } '' 149 + mkdir -p $out/lib/rocblas/library 150 + cp -a ${rocblas}/lib/rocblas/library/*gfx90* $out/lib/rocblas/library 151 + ''; 152 + 153 + gfx94 = runCommand "rocblas-gfx94" { preferLocalBuild = true; } '' 154 + mkdir -p $out/lib/rocblas/library 155 + cp -a ${rocblas}/lib/rocblas/library/*gfx94* $out/lib/rocblas/library 156 + ''; 157 + 158 + gfx10 = runCommand "rocblas-gfx10" { preferLocalBuild = true; } '' 159 + mkdir -p $out/lib/rocblas/library 160 + cp -a ${rocblas}/lib/rocblas/library/*gfx10* $out/lib/rocblas/library 161 + ''; 162 + 163 + gfx11 = runCommand "rocblas-gfx11" { preferLocalBuild = true; } '' 164 + mkdir -p $out/lib/rocblas/library 165 + cp -a ${rocblas}/lib/rocblas/library/*gfx11* $out/lib/rocblas/library 166 + ''; 167 + in stdenv.mkDerivation (finalAttrs: { 168 + inherit (rocblas) pname version src passthru meta; 169 + 170 + outputs = [ 171 + "out" 172 + ] ++ lib.optionals buildTests [ 173 + "test" 174 + ] ++ lib.optionals buildBenchmarks [ 175 + "benchmark" 176 + ]; 177 + 178 + dontUnpack = true; 179 + dontPatch = true; 180 + dontConfigure = true; 181 + dontBuild = true; 182 + 183 + installPhase = '' 184 + runHook preInstall 185 + 186 + mkdir -p $out 187 + cp -a --no-preserve=mode ${rocblas}/* $out 188 + ln -sf ${gfx80}/lib/rocblas/library/* $out/lib/rocblas/library 189 + ln -sf ${gfx90}/lib/rocblas/library/* $out/lib/rocblas/library 190 + ln -sf ${gfx94}/lib/rocblas/library/* $out/lib/rocblas/library 191 + ln -sf ${gfx10}/lib/rocblas/library/* $out/lib/rocblas/library 192 + ln -sf ${gfx11}/lib/rocblas/library/* $out/lib/rocblas/library 193 + '' + lib.optionalString buildTests '' 194 + cp -a ${rocblas.test} $test 195 + '' + lib.optionalString buildBenchmarks '' 196 + cp -a ${rocblas.benchmark} $benchmark 197 + '' + '' 198 + runHook postInstall 199 + ''; 200 + })
+169
pkgs/development/rocm-modules/5/rocfft/default.nix
··· 1 + { rocfft 2 + , lib 3 + , stdenv 4 + , fetchFromGitHub 5 + , rocmUpdateScript 6 + , cmake 7 + , clr 8 + , python3 9 + , rocm-cmake 10 + , sqlite 11 + , boost 12 + , fftw 13 + , fftwFloat 14 + , gtest 15 + , openmp 16 + , rocrand 17 + , gpuTargets ? [ ] 18 + }: 19 + 20 + stdenv.mkDerivation (finalAttrs: { 21 + pname = "rocfft"; 22 + version = "5.7.0"; 23 + 24 + src = fetchFromGitHub { 25 + owner = "ROCmSoftwarePlatform"; 26 + repo = "rocFFT"; 27 + rev = "rocm-${finalAttrs.version}"; 28 + hash = "sha256-GZSi03geTT+NUztBWhGYyghLqJGsFjUQzVAKQ7d03uA="; 29 + }; 30 + 31 + nativeBuildInputs = [ 32 + cmake 33 + clr 34 + python3 35 + rocm-cmake 36 + ]; 37 + 38 + buildInputs = [ sqlite ]; 39 + 40 + cmakeFlags = [ 41 + "-DCMAKE_C_COMPILER=hipcc" 42 + "-DCMAKE_CXX_COMPILER=hipcc" 43 + "-DSQLITE_USE_SYSTEM_PACKAGE=ON" 44 + # Manually define CMAKE_INSTALL_<DIR> 45 + # See: https://github.com/NixOS/nixpkgs/pull/197838 46 + "-DCMAKE_INSTALL_BINDIR=bin" 47 + "-DCMAKE_INSTALL_LIBDIR=lib" 48 + "-DCMAKE_INSTALL_INCLUDEDIR=include" 49 + ] ++ lib.optionals (gpuTargets != [ ]) [ 50 + "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" 51 + ]; 52 + 53 + passthru = { 54 + test = stdenv.mkDerivation { 55 + pname = "${finalAttrs.pname}-test"; 56 + inherit (finalAttrs) version src; 57 + 58 + sourceRoot = "${finalAttrs.src.name}/clients/tests"; 59 + 60 + nativeBuildInputs = [ 61 + cmake 62 + clr 63 + rocm-cmake 64 + ]; 65 + 66 + buildInputs = [ 67 + boost 68 + fftw 69 + fftwFloat 70 + finalAttrs.finalPackage 71 + gtest 72 + openmp 73 + rocrand 74 + ]; 75 + 76 + cmakeFlags = [ 77 + "-DCMAKE_C_COMPILER=hipcc" 78 + "-DCMAKE_CXX_COMPILER=hipcc" 79 + ]; 80 + 81 + postInstall = '' 82 + rm -r "$out/lib/fftw" 83 + rmdir "$out/lib" 84 + ''; 85 + }; 86 + 87 + benchmark = stdenv.mkDerivation { 88 + pname = "${finalAttrs.pname}-benchmark"; 89 + inherit (finalAttrs) version src; 90 + 91 + sourceRoot = "${finalAttrs.src.name}/clients/rider"; 92 + 93 + nativeBuildInputs = [ 94 + cmake 95 + clr 96 + rocm-cmake 97 + ]; 98 + 99 + buildInputs = [ 100 + boost 101 + finalAttrs.finalPackage 102 + openmp 103 + (python3.withPackages (ps: with ps; [ 104 + pandas 105 + scipy 106 + ])) 107 + rocrand 108 + ]; 109 + 110 + cmakeFlags = [ 111 + "-DCMAKE_C_COMPILER=hipcc" 112 + "-DCMAKE_CXX_COMPILER=hipcc" 113 + ]; 114 + 115 + postInstall = '' 116 + cp -a ../../../scripts/perf "$out/bin" 117 + ''; 118 + }; 119 + 120 + samples = stdenv.mkDerivation { 121 + pname = "${finalAttrs.pname}-samples"; 122 + inherit (finalAttrs) version src; 123 + 124 + sourceRoot = "${finalAttrs.src.name}/clients/samples"; 125 + 126 + nativeBuildInputs = [ 127 + cmake 128 + clr 129 + rocm-cmake 130 + ]; 131 + 132 + buildInputs = [ 133 + boost 134 + finalAttrs.finalPackage 135 + openmp 136 + rocrand 137 + ]; 138 + 139 + cmakeFlags = [ 140 + "-DCMAKE_C_COMPILER=hipcc" 141 + "-DCMAKE_CXX_COMPILER=hipcc" 142 + ]; 143 + 144 + installPhase = '' 145 + runHook preInstall 146 + mkdir "$out" 147 + cp -a bin "$out" 148 + runHook postInstall 149 + ''; 150 + }; 151 + 152 + updateScript = rocmUpdateScript { 153 + name = finalAttrs.pname; 154 + owner = finalAttrs.src.owner; 155 + repo = finalAttrs.src.repo; 156 + }; 157 + }; 158 + 159 + requiredSystemFeatures = [ "big-parallel" ]; 160 + 161 + meta = with lib; { 162 + description = "FFT implementation for ROCm"; 163 + homepage = "https://github.com/ROCmSoftwarePlatform/rocFFT"; 164 + license = with licenses; [ mit ]; 165 + maintainers = with maintainers; [ kira-bruneau ] ++ teams.rocm.members; 166 + platforms = platforms.linux; 167 + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 168 + }; 169 + })
+36
pkgs/development/rocm-modules/5/rocm-core/default.nix
··· 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , rocmUpdateScript 5 + , cmake 6 + }: 7 + 8 + stdenv.mkDerivation (finalAttrs: { 9 + pname = "rocm-core"; 10 + version = "5.7.0"; 11 + 12 + src = fetchFromGitHub { 13 + owner = "RadeonOpenCompute"; 14 + repo = "rocm-core"; 15 + rev = "rocm-${finalAttrs.version}"; 16 + hash = "sha256-jFAHLqf/AR27Nbuq8aypWiKqApNcTgG5LWESVjVCKIg="; 17 + }; 18 + 19 + nativeBuildInputs = [ cmake ]; 20 + cmakeFlags = [ "-DROCM_VERSION=${finalAttrs.version}" ]; 21 + 22 + passthru.updateScript = rocmUpdateScript { 23 + name = finalAttrs.pname; 24 + owner = finalAttrs.src.owner; 25 + repo = finalAttrs.src.repo; 26 + }; 27 + 28 + meta = with lib; { 29 + description = "Utility for getting the ROCm release version"; 30 + homepage = "https://github.com/RadeonOpenCompute/rocm-core"; 31 + license = with licenses; [ mit ]; 32 + maintainers = teams.rocm.members; 33 + platforms = platforms.linux; 34 + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; 35 + }; 36 + })
+65
pkgs/development/rocm-modules/5/rocm-docs-core/default.nix
··· 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , gitUpdater 5 + , buildPythonPackage 6 + , setuptools 7 + , beautifulsoup4 8 + , gitpython 9 + , pydata-sphinx-theme 10 + , pygithub 11 + , sphinx 12 + , breathe 13 + , myst-parser 14 + , sphinx-book-theme 15 + , sphinx-copybutton 16 + , sphinx-design 17 + , sphinx-external-toc 18 + , sphinx-notfound-page 19 + , pyyaml 20 + , fastjsonschema 21 + }: 22 + 23 + buildPythonPackage rec { 24 + pname = "rocm-docs-core"; 25 + version = "0.25.0"; 26 + format = "pyproject"; 27 + 28 + src = fetchFromGitHub { 29 + owner = "RadeonOpenCompute"; 30 + repo = "rocm-docs-core"; 31 + rev = "v${version}"; 32 + hash = "sha256-kOsoIK0vaPT60hGr960s5vc0eloSr5CECtd8Dy24YuM="; 33 + }; 34 + 35 + buildInputs = [ setuptools ]; 36 + 37 + propagatedBuildInputs = [ 38 + beautifulsoup4 39 + gitpython 40 + pydata-sphinx-theme 41 + pygithub 42 + sphinx 43 + breathe 44 + myst-parser 45 + sphinx-book-theme 46 + sphinx-copybutton 47 + sphinx-design 48 + sphinx-external-toc 49 + sphinx-notfound-page 50 + pyyaml 51 + fastjsonschema 52 + ]; 53 + 54 + pythonImportsCheck = [ "rocm_docs" ]; 55 + 56 + passthru.updateScript = gitUpdater { rev-prefix = "v"; }; 57 + 58 + meta = with lib; { 59 + description = "ROCm Documentation Python package for ReadTheDocs build standardization"; 60 + homepage = "https://github.com/RadeonOpenCompute/rocm-docs-core"; 61 + license = with licenses; [ mit cc-by-40 ]; 62 + maintainers = teams.rocm.members; 63 + platforms = platforms.linux; 64 + }; 65 + }
+108
pkgs/development/rocm-modules/5/rocprofiler/default.nix
··· 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , rocmUpdateScript 5 + , cmake 6 + , clang 7 + , clr 8 + , rocm-thunk 9 + , roctracer 10 + , rocm-smi 11 + , hsa-amd-aqlprofile-bin 12 + , numactl 13 + , libpciaccess 14 + , libxml2 15 + , elfutils 16 + , mpi 17 + , gtest 18 + , python3Packages 19 + , gpuTargets ? [ 20 + "gfx900" 21 + "gfx906" 22 + "gfx908" 23 + "gfx90a" 24 + "gfx940" 25 + "gfx941" 26 + "gfx942" 27 + "gfx1030" 28 + "gfx1100" 29 + "gfx1101" 30 + "gfx1102" 31 + ] 32 + }: 33 + 34 + stdenv.mkDerivation (finalAttrs: { 35 + pname = "rocprofiler"; 36 + version = "5.7.0"; 37 + 38 + src = fetchFromGitHub { 39 + owner = "ROCm-Developer-Tools"; 40 + repo = "rocprofiler"; 41 + rev = "rocm-${finalAttrs.version}"; 42 + hash = "sha256-ue/2uiLbhOv/5XY4cIJuZ8DUMRhniYgxolq9xMwO1FY="; 43 + }; 44 + 45 + nativeBuildInputs = [ 46 + cmake 47 + clang 48 + clr 49 + python3Packages.lxml 50 + python3Packages.cppheaderparser 51 + python3Packages.pyyaml 52 + python3Packages.barectf 53 + ]; 54 + 55 + buildInputs = [ 56 + rocm-thunk 57 + rocm-smi 58 + hsa-amd-aqlprofile-bin 59 + numactl 60 + libpciaccess 61 + libxml2 62 + elfutils 63 + mpi 64 + gtest 65 + ]; 66 + 67 + cmakeFlags = [ 68 + "-DCMAKE_MODULE_PATH=${clr}/lib/cmake/hip" 69 + "-DPROF_API_HEADER_PATH=${roctracer.src}/inc/ext" 70 + "-DHIP_ROOT_DIR=${clr}" 71 + "-DGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" 72 + # Manually define CMAKE_INSTALL_<DIR> 73 + # See: https://github.com/NixOS/nixpkgs/pull/197838 74 + "-DCMAKE_INSTALL_BINDIR=bin" 75 + "-DCMAKE_INSTALL_LIBDIR=lib" 76 + "-DCMAKE_INSTALL_INCLUDEDIR=include" 77 + ]; 78 + 79 + postPatch = '' 80 + patchShebangs . 81 + 82 + # Cannot find ROCm device library, pointless 83 + substituteInPlace CMakeLists.txt \ 84 + --replace "add_subdirectory(tests-v2)" "" \ 85 + --replace "add_subdirectory(samples)" "" 86 + ''; 87 + 88 + postBuild = '' 89 + # HSACO aren't being built for some reason 90 + substituteInPlace test/cmake_install.cmake \ 91 + --replace "file(INSTALL DESTINATION \"\''${CMAKE_INSTALL_PREFIX}/share/rocprofiler/tests-v1\" TYPE FILE FILES \"" "message(\"" 92 + ''; 93 + 94 + passthru.updateScript = rocmUpdateScript { 95 + name = finalAttrs.pname; 96 + owner = finalAttrs.src.owner; 97 + repo = finalAttrs.src.repo; 98 + }; 99 + 100 + meta = with lib; { 101 + description = "Profiling with perf-counters and derived metrics"; 102 + homepage = "https://github.com/ROCm-Developer-Tools/rocprofiler"; 103 + license = with licenses; [ mit ]; # mitx11 104 + maintainers = teams.rocm.members; 105 + platforms = platforms.linux; 106 + broken = versions.minor finalAttrs.version != versions.minor clr.version; 107 + }; 108 + })
+2 -2
pkgs/development/rocm-modules/update-script/default.nix pkgs/development/rocm-modules/5/update.nix
··· 12 12 let 13 13 pname = 14 14 if lib.hasPrefix "rocm-llvm-" name 15 - then "llvmPackages_rocm.${lib.removePrefix "rocm-llvm-" name}" 15 + then "llvm.${lib.removePrefix "rocm-llvm-" name}" 16 16 else name; 17 17 18 18 updateScript = writeScript "update.sh" '' ··· 27 27 version="''${version}.0" 28 28 fi 29 29 30 - update-source-version ${pname} "$version" --ignore-same-hash 30 + update-source-version rocmPackages_5.${pname} "$version" --ignore-same-hash 31 31 ''; 32 32 in [ updateScript ]
+4 -2
pkgs/development/tools/build-managers/rocm-cmake/default.nix pkgs/development/rocm-modules/5/rocm-cmake/default.nix
··· 7 7 8 8 stdenv.mkDerivation (finalAttrs: { 9 9 pname = "rocm-cmake"; 10 - version = "5.4.4"; 10 + version = "5.7.0"; 11 11 12 12 src = fetchFromGitHub { 13 13 owner = "RadeonOpenCompute"; 14 14 repo = "rocm-cmake"; 15 15 rev = "rocm-${finalAttrs.version}"; 16 - hash = "sha256-JarQqiiZ36WV1d6vyQD546GN1EtoKLcdvcZsG3QWD2Y="; 16 + hash = "sha256-aVjzuJ4BiSfwOdjufFc5CznfnL8di5h992zl+pzD0DU="; 17 17 }; 18 18 19 19 nativeBuildInputs = [ cmake ]; ··· 22 22 name = finalAttrs.pname; 23 23 owner = finalAttrs.src.owner; 24 24 repo = finalAttrs.src.repo; 25 + page = "releases?per_page=2"; 26 + filter = ".[1].tag_name | split(\"-\") | .[1]"; 25 27 }; 26 28 27 29 meta = with lib; {
+4 -3
pkgs/development/tools/misc/rdc/default.nix pkgs/development/rocm-modules/5/rdc/default.nix
··· 41 41 }; 42 42 in stdenv.mkDerivation (finalAttrs: { 43 43 pname = "rdc"; 44 - version = "5.4.2"; 44 + version = "5.7.0"; 45 45 46 46 outputs = [ 47 47 "out" ··· 55 55 owner = "RadeonOpenCompute"; 56 56 repo = "rdc"; 57 57 rev = "rocm-${finalAttrs.version}"; 58 - hash = "sha256-dYacqkRp+zVejo/4dME1K6EN8t/1EBtIynEQ+AQ4JZo="; 58 + hash = "sha256-xZD/WI/LfNtKK9j6ZjuU0OTTFZz3G4atyD5mVcSsQ8A="; 59 59 }; 60 60 61 61 nativeBuildInputs = [ ··· 120 120 license = with licenses; [ mit ]; 121 121 maintainers = teams.rocm.members; 122 122 platforms = platforms.linux; 123 - broken = versions.minor finalAttrs.version != versions.minor rocm-smi.version; 123 + # broken = versions.minor finalAttrs.version != versions.minor rocm-smi.version; 124 + broken = true; # Too many errors, unsure how to fix 124 125 }; 125 126 })
+2 -2
pkgs/development/tools/misc/rocgdb/default.nix pkgs/development/rocm-modules/5/rocgdb/default.nix
··· 15 15 16 16 stdenv.mkDerivation (finalAttrs: { 17 17 pname = "rocgdb"; 18 - version = "5.4.2"; 18 + version = "5.7.0"; 19 19 20 20 src = fetchFromGitHub { 21 21 owner = "ROCm-Developer-Tools"; 22 22 repo = "ROCgdb"; 23 23 rev = "rocm-${finalAttrs.version}"; 24 - hash = "sha256-DORPvfon32+rIk+YcO9LlUefNvvC7trmiTswg9MMuIs="; 24 + hash = "sha256-TlT7vvTrVd7P6ilVnWIG5VIrjTleFgDezK/mudBV+xE="; 25 25 }; 26 26 27 27 nativeBuildInputs = [
+2 -2
pkgs/development/tools/rocminfo/default.nix pkgs/development/rocm-modules/5/rocminfo/default.nix
··· 18 18 }: 19 19 20 20 stdenv.mkDerivation (finalAttrs: { 21 - version = "5.4.4"; 21 + version = "5.7.0"; 22 22 pname = "rocminfo"; 23 23 24 24 src = fetchFromGitHub { 25 25 owner = "RadeonOpenCompute"; 26 26 repo = "rocminfo"; 27 27 rev = "rocm-${finalAttrs.version}"; 28 - sha256 = "sha256-4wZTm5AZgG8xEd6uYqxWq4bWZgcSYZ2WYA1z4RAPF8U="; 28 + sha256 = "sha256-UzOo2qDT/uM+vdGdBM4pV5e143mfa+/6sZLBExOO26g="; 29 29 }; 30 30 31 31 nativeBuildInputs = [
+1 -1
pkgs/test/default.nix
··· 8 8 llvmTests = let 9 9 pkgSets = lib.pipe pkgNames [ 10 10 (filter (lib.hasPrefix "llvmPackages")) 11 - (filter (n: n != "llvmPackages_rocm")) 11 + (filter (n: n != "rocmPackages.llvm")) 12 12 (filter (n: n != "llvmPackages_latest")) 13 13 (filter (n: n != "llvmPackages_git")) 14 14 ];
pkgs/tools/system/rocm-smi/cmake.patch pkgs/development/rocm-modules/5/rocm-smi/cmake.patch
+15 -7
pkgs/tools/system/rocm-smi/default.nix pkgs/development/rocm-modules/5/rocm-smi/default.nix
··· 8 8 9 9 stdenv.mkDerivation (finalAttrs: { 10 10 pname = "rocm-smi"; 11 - version = "5.4.4"; 11 + version = "5.7.0"; 12 12 13 13 src = fetchFromGitHub { 14 14 owner = "RadeonOpenCompute"; 15 15 repo = "rocm_smi_lib"; 16 16 rev = "rocm-${finalAttrs.version}"; 17 - hash = "sha256-nkidiDNNU6MGhne9EbYClkODJZw/zZu3LWzlniJKyJE="; 17 + hash = "sha256-swCRO4PBMBJ6fO2bLq/xxFZIYw2IgiFB490wsU8Wm2o="; 18 18 }; 19 19 20 - postPatch = '' 21 - sed '1i#include <cstring>' -i src/rocm_smi{,_gpu_metrics}.cc # since gcc12 probably 22 - ''; 20 + patches = [ ./cmake.patch ]; 23 21 24 - nativeBuildInputs = [ cmake wrapPython ]; 22 + nativeBuildInputs = [ 23 + cmake 24 + wrapPython 25 + ]; 25 26 26 - patches = [ ./cmake.patch ]; 27 + cmakeFlags = [ 28 + # Manually define CMAKE_INSTALL_<DIR> 29 + # See: https://github.com/NixOS/nixpkgs/pull/197838 30 + "-DCMAKE_INSTALL_BINDIR=bin" 31 + "-DCMAKE_INSTALL_LIBDIR=lib" 32 + "-DCMAKE_INSTALL_INCLUDEDIR=include" 33 + ]; 27 34 28 35 postInstall = '' 29 36 wrapPythonProgramsIn $out 37 + mv $out/libexec/rocm_smi/.rsmiBindings.py-wrapped $out/libexec/rocm_smi/rsmiBindings.py 30 38 ''; 31 39 32 40 passthru.updateScript = rocmUpdateScript {
+52
pkgs/top-level/aliases.nix
··· 130 130 chocolateDoom = chocolate-doom; # Added 2023-05-01 131 131 chrome-gnome-shell = gnome-browser-connector; # Added 2022-07-27 132 132 citra = citra-nightly; # added 2022-05-17 133 + clang-ocl = throw "'clang-ocl' has been replaced with 'rocmPackages.clang-ocl'"; # Added 2023-10-08 133 134 inherit (libsForQt5.mauiPackages) clip; # added 2022-05-17 135 + composable_kernel = throw "'composable_kernel' has been replaced with 'rocmPackages.composable_kernel'"; # Added 2023-10-08 134 136 cpp-ipfs-api = cpp-ipfs-http-client; # Project has been renamed. Added 2022-05-15 135 137 crispyDoom = crispy-doom; # Added 2023-05-01 136 138 clasp = clingo; # added 2022-12-22 ··· 332 334 haxe_3_2 = throw "'haxe_3_2' has been removed because it is old and no longer used by any packages in nixpkgs"; # Added 2023-03-15 333 335 haxe_3_4 = throw "'haxe_3_4' has been removed because it is old and no longer used by any packages in nixpkgs"; # Added 2023-03-15 334 336 hepmc = throw "'hepmc' has been renamed to/replaced by 'hepmc2'"; # Converted to throw 2023-09-10 337 + hip = throw "'hip' has been removed in favor of 'rocmPackages.clr'"; # Added 2023-10-08 338 + hipcc = throw "'hipcc' has been replaced with 'rocmPackages.hipcc'"; # Added 2023-10-08 339 + hipify = throw "'hipify' has been replaced with 'rocmPackages.hipify'"; # Added 2023-10-08 340 + hipcub = throw "'hipcub' has been replaced with 'rocmPackages.hipcub'"; # Added 2023-10-08 341 + hipsparse = throw "'hipsparse' has been replaced with 'rocmPackages.hipsparse'"; # Added 2023-10-08 342 + hipfort = throw "'hipfort' has been replaced with 'rocmPackages.hipfort'"; # Added 2023-10-08 343 + hipfft = throw "'hipfft' has been replaced with 'rocmPackages.hipfft'"; # Added 2023-10-08 344 + hipsolver = throw "'hipsolver' has been replaced with 'rocmPackages.hipsolver'"; # Added 2023-10-08 345 + hipblas = throw "'hipblas' has been replaced with 'rocmPackages.hipblas'"; # Added 2023-10-08 346 + hip-amd = throw "'hip-amd' has been removed in favor of 'rocmPackages.clr'"; # Added 2023-10-08 347 + hip-common = throw "'hip-common' has been replaced with 'rocmPackages.hip-common'"; # Added 2023-10-08 348 + hip-nvidia = throw "'hip-nvidia' has been removed in favor of 'rocmPackages.clr'"; # Added 2023-10-08 335 349 ht-rust = xh; # Added 2021-02-13 336 350 hydra-unstable = hydra_unstable; # added 2022-05-10 337 351 ··· 404 418 latinmodern-math = lmmath; 405 419 ldgallery = throw "'ldgallery' has been removed from nixpkgs. Use the Flake provided by ldgallery instead"; # Added 2023-07-26 406 420 lfs = dysk; # Added 2023-07-03 421 + llvmPackages_rocm = throw "'llvmPackages_rocm' has been replaced with 'rocmPackages.llvm'"; # Added 2023-10-08 407 422 libayatana-indicator-gtk3 = libayatana-indicator; # Added 2022-10-18 408 423 libayatana-appindicator-gtk3 = libayatana-appindicator; # Added 2022-10-18 409 424 libbencodetools = bencodetools; # Added 2022-07-30 ··· 527 542 meme = meme-image-generator; # Added 2021-04-21 528 543 mess = throw "'mess' has been renamed to/replaced by 'mame'"; # Converted to throw 2023-09-10 529 544 microsoft_gsl = microsoft-gsl; # Added 2023-05-26 545 + migraphx = throw "'migraphx' has been replaced with 'rocmPackages.migraphx'"; # Added 2023-10-08 546 + miopen = throw "'miopen' has been replaced with 'rocmPackages.miopen'"; # Added 2023-10-08 547 + miopengemm = throw "'miopengemm' has been replaced with 'rocmPackages.miopengemm'"; # Added 2023-10-08 548 + miopen-hip = throw "'miopen-hip' has been replaced with 'rocmPackages.miopen-hip'"; # Added 2023-10-08 549 + miopen-opencl = throw "'miopen-opencl' has been replaced with 'rocmPackages.miopen-opencl'"; # Added 2023-10-08 530 550 mime-types = mailcap; # Added 2022-01-21 531 551 minizip2 = pkgs.minizip-ng; # Added 2022-12-28 532 552 monero = monero-cli; # Added 2021-11-28 ··· 704 724 radare2-cutter = cutter; # Added 2021-03-30 705 725 rambox-pro = rambox; # Added 2022-12-12 706 726 rarian = throw "rarian has been removed as unused"; # Added 2023-07-05 727 + rccl = throw "'rccl' has been replaced with 'rocmPackages.rccl'"; # Added 2023-10-08 728 + rdc = throw "'rdc' has been replaced with 'rocmPackages.rdc'"; # Added 2023-10-08 707 729 retroshare06 = retroshare; 708 730 rigsofrods = rigsofrods-bin; # Added 2023-03-22 709 731 ring-daemon = jami-daemon; # Added 2021-10-26 710 732 rockbox_utility = rockbox-utility; # Added 2022-03-17 733 + rocalution = throw "'rocalution' has been replaced with 'rocmPackages.rocalution'"; # Added 2023-10-08 734 + rocblas = throw "'rocblas' has been replaced with 'rocmPackages.rocblas'"; # Added 2023-10-08 735 + rocfft = throw "'rocfft' has been replaced with 'rocmPackages.rocfft'"; # Added 2023-10-08 736 + rocprim = throw "'rocprim' has been replaced with 'rocmPackages.rocprim'"; # Added 2023-10-08 737 + rocrand = throw "'rocrand' has been replaced with 'rocmPackages.rocrand'"; # Added 2023-10-08 738 + rocsparse = throw "'rocsparse' has been replaced with 'rocmPackages.rocsparse'"; # Added 2023-10-08 739 + rocthrust = throw "'rocthrust' has been replaced with 'rocmPackages.rocthrust'"; # Added 2023-10-08 740 + roctracer = throw "'roctracer' has been replaced with 'rocmPackages.roctracer'"; # Added 2023-10-08 741 + rocwmma = throw "'rocwmma' has been replaced with 'rocmPackages.rocwmma'"; # Added 2023-10-08 742 + rocclr = throw "'rocclr' has been removed in favor of 'rocmPackages.clr'"; # Added 2023-10-08 743 + rocdbgapi = throw "'rocdbgapi' has been replaced with 'rocmPackages.rocdbgapi'"; # Added 2023-10-08 744 + rocgdb = throw "'rocgdb' has been replaced with 'rocmPackages.rocgdb'"; # Added 2023-10-08 745 + rocprofiler = throw "'rocprofiler' has been replaced with 'rocmPackages.rocprofiler'"; # Added 2023-10-08 746 + rocsolver = throw "'rocsolver' has been replaced with 'rocmPackages.rocsolver'"; # Added 2023-10-08 747 + rocmClangStdenv = throw "'rocmClangStdenv' has been moved to 'rocmPackages' and is no longer public"; # Added 2023-10-08 748 + rocmUpdateScript = throw "'rocmUpdateScript' has been moved to 'rocmPackages' and is no longer public"; # Added 2023-10-08 749 + rocminfo = throw "'rocminfo' has been replaced with 'rocmPackages.rocminfo'"; # Added 2023-10-08 750 + rocmlir = throw "'rocmlir' has been replaced with 'rocmPackages.rocmlir'"; # Added 2023-10-08 751 + rocmlir-rock = throw "'rocmlir-rock' has been replaced with 'rocmPackages.rocmlir-rock'"; # Added 2023-10-08 752 + rocm-cmake = throw "'rocm-cmake' has been replaced with 'rocmPackages.rocm-cmake'"; # Added 2023-10-08 753 + rocm-comgr = throw "'rocm-comgr' has been replaced with 'rocmPackages.rocm-comgr'"; # Added 2023-10-08 754 + rocm-core = throw "'rocm-core' has been replaced with 'rocmPackages.rocm-core'"; # Added 2023-10-08 755 + rocm-device-libs = throw "'rccl' has been replaced with 'rocmPackages.rocm-device-libs'"; # Added 2023-10-08 756 + rocm-opencl-icd = lib.warn "'rocm-opencl-icd' has been replaced with 'rocmPackages.clr.icd'" rocmPackages.clr.icd; # Added 2023-10-08 757 + rocm-opencl-runtime = lib.warn "'rocm-opencl-runtime' has been replaced with 'rocmPackages.clr'" rocmPackages.clr; # Added 2023-10-08 758 + rocm-runtime = throw "'rocm-runtime' has been replaced with 'rocmPackages.rocm-runtime'"; # Added 2023-10-08 759 + rocm-smi = throw "'rocm-smi' has been replaced with 'rocmPackages.rocm-smi'"; # Added 2023-10-08 760 + rocm-thunk = throw "'rocm-thunk' has been replaced with 'rocmPackages.rocm-thunk'"; # Added 2023-10-08 761 + rocr-debug-agent = throw "'rocr-debug-agent' has been replaced with 'rocmPackages.rocr-debug-agent'"; # Added 2023-10-08 711 762 rome = throw "rome is no longer maintained, consider using biome instead"; # Added 2023-09-12 712 763 rpiboot-unstable = rpiboot; # Added 2021-07-30 713 764 rr-unstable = rr; # Added 2022-09-17 ··· 796 847 taro = taproot-assets; # Added 2023-07-04 797 848 tdesktop = telegram-desktop; # Added 2023-04-07 798 849 telegram-cli = throw "telegram-cli was removed because it was broken and abandoned upstream"; # Added 2023-07-28 850 + tensile = throw "'tensile' has been replaced with 'rocmPackages.tensile'"; # Added 2023-10-08 799 851 testVersion = testers.testVersion; # Added 2022-04-20 800 852 invalidateFetcherByDrvHash = testers.invalidateFetcherByDrvHash; # Added 2022-05-05 801 853 timescale-prometheus = promscale; # Added 2020-09-29
+7 -223
pkgs/top-level/all-packages.nix
··· 687 687 688 688 frugal = callPackage ../development/tools/frugal { }; 689 689 690 + frugally-deep = callPackage ../development/libraries/frugally-deep { }; 691 + 690 692 functiontrace-server = callPackage ../development/tools/functiontrace-server { }; 691 693 692 694 gendef = callPackage ../development/tools/gendef { }; ··· 7770 7772 7771 7773 rar2fs = callPackage ../tools/filesystems/rar2fs { }; 7772 7774 7775 + rocmPackages = rocmPackages_5; 7776 + rocmPackages_5 = recurseIntoAttrs (callPackage ../development/rocm-modules/5 { }); 7777 + 7773 7778 rune = callPackage ../development/interpreters/rune { }; 7774 7779 7775 7780 s9fes = callPackage ../development/interpreters/s9fes { }; ··· 15718 15723 clangStdenv = if stdenv.cc.isClang then stdenv else lowPrio llvmPackages.stdenv; 15719 15724 clang-sierraHack-stdenv = overrideCC stdenv buildPackages.clang-sierraHack; 15720 15725 libcxxStdenv = if stdenv.isDarwin then stdenv else lowPrio llvmPackages.libcxxStdenv; 15721 - rocmClangStdenv = llvmPackages_rocm.rocmClangStdenv; 15722 15726 15723 15727 clean = callPackage ../development/compilers/clean { }; 15724 15728 ··· 16773 16777 targetLlvm = targetPackages.llvmPackages_16.llvm or llvmPackages_16.llvm; 16774 16778 })); 16775 16779 16776 - llvmPackages_rocm = recurseIntoAttrs (callPackage ../development/compilers/llvm/rocm { }); 16777 - 16778 16780 lorri = callPackage ../tools/misc/lorri { 16779 16781 inherit (darwin.apple_sdk.frameworks) CoreServices Security; 16780 16782 }; ··· 16959 16961 16960 16962 rml = callPackage ../development/compilers/rml { }; 16961 16963 16962 - composable_kernel = callPackage ../development/libraries/composable_kernel { 16963 - inherit (llvmPackages_rocm) openmp clang-tools-extra; 16964 - stdenv = rocmClangStdenv; 16965 - }; 16966 - 16967 - rocprofiler = callPackage ../development/libraries/rocprofiler { 16968 - stdenv = rocmClangStdenv; 16969 - }; 16970 - 16971 - clang-ocl = callPackage ../development/libraries/clang-ocl { 16972 - stdenv = rocmClangStdenv; 16973 - }; 16974 - 16975 16964 rgxg = callPackage ../tools/text/rgxg { }; 16976 - 16977 - rocclr = callPackage ../development/libraries/rocclr { 16978 - stdenv = rocmClangStdenv; 16979 - }; 16980 - 16981 - hip-common = callPackage ../development/compilers/hip-common { 16982 - inherit (llvmPackages_rocm) llvm; 16983 - stdenv = rocmClangStdenv; 16984 - }; 16985 - 16986 - hipcc = callPackage ../development/compilers/hipcc { 16987 - inherit (llvmPackages_rocm) llvm; 16988 - stdenv = rocmClangStdenv; 16989 - }; 16990 - 16991 - hip = callPackage ../development/compilers/hip { 16992 - inherit (llvmPackages_rocm) llvm; 16993 - inherit (cudaPackages) cudatoolkit; 16994 - stdenv = rocmClangStdenv; 16995 - }; 16996 - 16997 - hip-amd = hip.override { 16998 - useNVIDIA = false; 16999 - }; 17000 - 17001 - hip-nvidia = hip.override { 17002 - useNVIDIA = true; 17003 - }; 17004 - 17005 - hipify = callPackage ../development/compilers/hipify { 17006 - stdenv = rocmClangStdenv; 17007 - }; 17008 - 17009 - hipcub = callPackage ../development/libraries/hipcub { 17010 - stdenv = rocmClangStdenv; 17011 - }; 17012 - 17013 - hipsparse = callPackage ../development/libraries/hipsparse { 17014 - inherit (llvmPackages_rocm) openmp; 17015 - stdenv = rocmClangStdenv; 17016 - }; 17017 - 17018 - hipfort = callPackage ../development/libraries/hipfort { 17019 - stdenv = rocmClangStdenv; 17020 - }; 17021 - 17022 - hipfft = callPackage ../development/libraries/hipfft { 17023 - inherit (llvmPackages_rocm) openmp; 17024 - stdenv = rocmClangStdenv; 17025 - }; 17026 - 17027 - hipsolver = callPackage ../development/libraries/hipsolver { 17028 - stdenv = rocmClangStdenv; 17029 - }; 17030 - 17031 - hipblas = callPackage ../development/libraries/hipblas { 17032 - stdenv = rocmClangStdenv; 17033 - }; 17034 - 17035 - migraphx = callPackage ../development/libraries/migraphx { 17036 - inherit (llvmPackages_rocm) clang-tools-extra openmp; 17037 - stdenv = rocmClangStdenv; 17038 - rocmlir = rocmlir-rock; 17039 - }; 17040 - 17041 - rccl = callPackage ../development/libraries/rccl { 17042 - stdenv = rocmClangStdenv; 17043 - }; 17044 - 17045 - rocm-cmake = callPackage ../development/tools/build-managers/rocm-cmake { 17046 - stdenv = rocmClangStdenv; 17047 - }; 17048 - 17049 - rocm-comgr = callPackage ../development/libraries/rocm-comgr { 17050 - stdenv = rocmClangStdenv; 17051 - }; 17052 - 17053 - rocalution = callPackage ../development/libraries/rocalution { 17054 - inherit (llvmPackages_rocm) openmp; 17055 - stdenv = rocmClangStdenv; 17056 - }; 17057 - 17058 - rocm-device-libs = callPackage ../development/libraries/rocm-device-libs { 17059 - stdenv = rocmClangStdenv; 17060 - }; 17061 - 17062 - rocm-opencl-icd = callPackage ../development/libraries/rocm-opencl-icd { 17063 - stdenv = rocmClangStdenv; 17064 - }; 17065 - 17066 - rocsolver = callPackage ../development/libraries/rocsolver { 17067 - stdenv = rocmClangStdenv; 17068 - }; 17069 - 17070 - rocm-opencl-runtime = callPackage ../development/libraries/rocm-opencl-runtime { 17071 - stdenv = rocmClangStdenv; 17072 - }; 17073 - 17074 - rocm-runtime = callPackage ../development/libraries/rocm-runtime { 17075 - stdenv = rocmClangStdenv; 17076 - }; 17077 - 17078 - rocm-smi = python3Packages.callPackage ../tools/system/rocm-smi { 17079 - stdenv = rocmClangStdenv; 17080 - }; 17081 - 17082 - rocm-thunk = callPackage ../development/libraries/rocm-thunk { 17083 - stdenv = rocmClangStdenv; 17084 - }; 17085 - 17086 - rocminfo = callPackage ../development/tools/rocminfo { 17087 - stdenv = rocmClangStdenv; 17088 - }; 17089 - 17090 - rocmlir = callPackage ../development/libraries/rocmlir { 17091 - stdenv = rocmClangStdenv; 17092 - }; 17093 - 17094 - # Best just use GCC here 17095 - rdc = callPackage ../development/tools/misc/rdc { }; 17096 - 17097 - # Best just use GCC here 17098 - rocgdb = callPackage ../development/tools/misc/rocgdb { 17099 - elfutils = elfutils.override { enableDebuginfod = true; }; 17100 - }; 17101 - 17102 - rocdbgapi = callPackage ../development/libraries/rocdbgapi { 17103 - stdenv = rocmClangStdenv; 17104 - }; 17105 - 17106 - rocr-debug-agent = callPackage ../development/libraries/rocr-debug-agent { 17107 - stdenv = rocmClangStdenv; 17108 - }; 17109 - 17110 - rocmlir-rock = rocmlir.override { 17111 - buildRockCompiler = true; 17112 - }; 17113 - 17114 - rocm-core = callPackage ../development/libraries/rocm-core { 17115 - stdenv = rocmClangStdenv; 17116 - }; 17117 - 17118 - rocprim = callPackage ../development/libraries/rocprim { 17119 - stdenv = rocmClangStdenv; 17120 - }; 17121 - 17122 - rocsparse = callPackage ../development/libraries/rocsparse { 17123 - stdenv = rocmClangStdenv; 17124 - }; 17125 - 17126 - rocfft = callPackage ../development/libraries/rocfft { 17127 - inherit (llvmPackages_rocm) openmp; 17128 - stdenv = rocmClangStdenv; 17129 - }; 17130 - 17131 - rocrand = callPackage ../development/libraries/rocrand { 17132 - stdenv = rocmClangStdenv; 17133 - }; 17134 - 17135 - tensile = python3Packages.callPackage ../development/libraries/tensile { 17136 - stdenv = rocmClangStdenv; 17137 - }; 17138 - 17139 - rocwmma = callPackage ../development/libraries/rocwmma { 17140 - inherit (llvmPackages_rocm) openmp; 17141 - stdenv = rocmClangStdenv; 17142 - }; 17143 - 17144 - rocblas = callPackage ../development/libraries/rocblas { 17145 - inherit (llvmPackages_rocm) openmp; 17146 - stdenv = rocmClangStdenv; 17147 - }; 17148 - 17149 - miopengemm = callPackage ../development/libraries/miopengemm { 17150 - stdenv = rocmClangStdenv; 17151 - }; 17152 - 17153 - rocthrust = callPackage ../development/libraries/rocthrust { 17154 - stdenv = rocmClangStdenv; 17155 - }; 17156 - 17157 - miopen = callPackage ../development/libraries/miopen { 17158 - inherit (llvmPackages_rocm) llvm clang-tools-extra; 17159 - stdenv = rocmClangStdenv; 17160 - rocmlir = rocmlir-rock; 17161 - boost = boost179.override { enableStatic = true; }; 17162 - }; 17163 - 17164 - miopen-hip = miopen.override { 17165 - useOpenCL = false; 17166 - }; 17167 - 17168 - miopen-opencl = miopen.override { 17169 - useOpenCL = true; 17170 - }; 17171 - 17172 - rocmUpdateScript = callPackage ../development/rocm-modules/update-script { }; 17173 - 17174 - # Requires GCC 17175 - roctracer = callPackage ../development/libraries/roctracer { 17176 - inherit (llvmPackages_rocm) clang; 17177 - }; 17178 16965 17179 16966 rtags = callPackage ../development/tools/rtags { 17180 16967 inherit (darwin) apple_sdk; ··· 39474 39261 39475 39262 lie = callPackage ../applications/science/math/LiE { }; 39476 39263 39477 - inherit (callPackage ../development/libraries/science/math/magma { 39478 - inherit (llvmPackages_rocm) openmp; 39479 - }) magma magma_2_7_2 magma_2_6_2; 39264 + inherit (callPackage ../development/libraries/science/math/magma { }) magma magma_2_7_2 magma_2_6_2; 39480 39265 39481 39266 magma-cuda = magma.override { 39482 39267 cudaSupport = true; ··· 39487 39272 static = true; 39488 39273 }; 39489 39274 39490 - # TODO:AMD won't compile with anything newer than 2.6.2 -- it fails at the linking stage. 39491 - magma-hip = magma_2_6_2.override { 39275 + magma-hip = magma.override { 39492 39276 cudaSupport = false; 39493 39277 rocmSupport = true; 39494 39278 };
+3 -2
pkgs/top-level/python-packages.nix
··· 1299 1299 inherit (pkgs.ocaml-ng.ocamlPackages) bap; 1300 1300 }; 1301 1301 1302 + barectf = callPackage ../development/python-modules/barectf { }; 1303 + 1302 1304 baron = callPackage ../development/python-modules/baron { }; 1303 1305 1304 1306 base36 = callPackage ../development/python-modules/base36 { }; ··· 8349 8351 8350 8352 open-meteo = callPackage ../development/python-modules/open-meteo { }; 8351 8353 8352 - openai-triton = callPackage ../development/python-modules/openai-triton { llvmPackages = pkgs.llvmPackages_rocm; }; 8354 + openai-triton = callPackage ../development/python-modules/openai-triton { cudaPackages = pkgs.cudaPackages_12_0; }; 8353 8355 8354 8356 openai-triton-bin = callPackage ../development/python-modules/openai-triton/bin.nix { }; 8355 8357 ··· 13906 13908 else pkgs.magma; 13907 13909 inherit (pkgs.darwin.apple_sdk.frameworks) Accelerate CoreServices; 13908 13910 inherit (pkgs.darwin) libobjc; 13909 - inherit (pkgs.llvmPackages_rocm) openmp; 13910 13911 }; 13911 13912 13912 13913 torch-bin = callPackage ../development/python-modules/torch/bin.nix {