@@ -688,6 +688,8 @@ static const std::string cpu_pipeline =
688
688
" arith-expand,"
689
689
" memref-expand,"
690
690
" func.func(empty-tensor-to-alloc-tensor),"
691
+ " cse,"
692
+ " canonicalize,"
691
693
" one-shot-bufferize,"
692
694
" canonicalize,"
693
695
" imex-remove-temporaries,"
@@ -728,53 +730,46 @@ static const std::string gpu_pipeline =
728
730
" linalg-fuse-elementwise-ops,"
729
731
" arith-expand,"
730
732
" memref-expand,"
731
- " arith-bufferize,"
732
- " func-bufferize,"
733
733
" func.func(empty-tensor-to-alloc-tensor),"
734
- " func.func(scf-bufferize),"
735
- " func.func(tensor-bufferize),"
736
- " func.func(bufferization-bufferize),"
737
- " func.func(linalg-bufferize),"
738
- " func.func(linalg-detensorize),"
739
- " func.func(tensor-bufferize),"
734
+ " func.func(tile-loops{tile-sizes=128 in-regions}),"
735
+ " func.func(tile-loops{tile-sizes=1 in-regions}),"
740
736
" region-bufferize,"
741
737
" canonicalize,"
742
- " func.func(finalizing-bufferize),"
738
+ " one-shot-bufferize,"
739
+ " cse,"
740
+ " canonicalize,"
741
+ " scf-forall-to-parallel,"
742
+ " cse,"
743
+ " canonicalize,"
743
744
" imex-remove-temporaries,"
744
- " func.func(convert-linalg-to-parallel-loops),"
745
- " func.func(scf-parallel-loop-fusion),"
746
- // GPU
747
- " func.func(imex-add-outer-parallel-loop),"
745
+ " buffer-deallocation-pipeline,"
746
+ " func.func(convert-linalg-to-loops),"
748
747
" func.func(gpu-map-parallel-loops),"
749
- " func.func(convert-parallel-loops-to-gpu),"
750
- // insert-gpu-allocs pass can have client-api = opencl or vulkan args
751
- " func.func(insert-gpu-allocs{in-regions=1}),"
748
+ " convert-parallel-loops-to-gpu,"
749
+ " canonicalize,"
750
+ " cse,"
751
+ " func.func(insert-gpu-allocs{in-regions=1 host-shared=0}),"
752
+ " func.func(insert-gpu-copy),"
752
753
" drop-regions,"
753
754
" canonicalize,"
754
- // "normalize-memrefs,"
755
- // "gpu-decompose-memrefs,"
756
- " func.func(lower-affine),"
757
755
" gpu-kernel-outlining,"
756
+ " convert-scf-to-cf,"
757
+ " convert-cf-to-llvm,"
758
758
" canonicalize,"
759
759
" cse,"
760
- // The following set-spirv-* passes can have client-api = opencl or vulkan
761
- // args
762
- " set-spirv-capabilities{client-api=opencl},"
763
- " gpu.module(set-spirv-abi-attrs{client-api=opencl}),"
764
- " canonicalize,"
765
- " fold-memref-alias-ops,"
766
- " imex-convert-gpu-to-spirv{enable-vc-intrinsic=1},"
767
- " spirv.module(spirv-lower-abi-attrs),"
768
- " spirv.module(spirv-update-vce),"
769
- // "func.func(llvm-request-c-wrappers),"
770
- " serialize-spirv,"
760
+ " gpu.module(strip-debuginfo,"
761
+ " convert-gpu-to-nvvm),"
762
+ " nvvm-attach-target{chip=sm_80 O=3},"
763
+ " func.func(gpu-async-region),"
771
764
" expand-strided-metadata,"
772
765
" lower-affine,"
773
- " convert- gpu-to-gpux ,"
766
+ " gpu-to-llvm ,"
774
767
" convert-func-to-llvm,"
775
768
" convert-math-to-llvm,"
776
- " convert-gpux-to-llvm,"
777
769
" finalize-memref-to-llvm,"
770
+ " canonicalize,"
771
+ " cse,"
772
+ " gpu-module-to-binary{format=fatbin},"
778
773
" reconcile-unrealized-casts" ;
779
774
780
775
const std::string _passes (get_text_env (" SHARPY_PASSES" ));
@@ -831,22 +826,20 @@ JIT::JIT(const std::string &libidtr)
831
826
_crunnerlib = mlirRoot + " /lib/libmlir_c_runner_utils.so" ;
832
827
_runnerlib = mlirRoot + " /lib/libmlir_runner_utils.so" ;
833
828
if (!std::ifstream (_crunnerlib)) {
834
- throw std::runtime_error (" Cannot find libmlir_c_runner_utils.so " );
829
+ throw std::runtime_error (" Cannot find lib: " + _crunnerlib );
835
830
}
836
831
if (!std::ifstream (_runnerlib)) {
837
- throw std::runtime_error (" Cannot find libmlir_runner_utils.so " );
832
+ throw std::runtime_error (" Cannot find lib: " + _runnerlib );
838
833
}
839
834
840
835
if (useGPU ()) {
841
836
auto gpuxlibstr = get_text_env (" SHARPY_GPUX_SO" );
842
837
if (!gpuxlibstr.empty ()) {
843
838
_gpulib = std::string (gpuxlibstr);
844
839
} else {
845
- auto imexRoot = get_text_env (" IMEXROOT" );
846
- imexRoot = !imexRoot.empty () ? imexRoot : std::string (CMAKE_IMEX_ROOT);
847
- _gpulib = imexRoot + " /lib/liblevel-zero-runtime.so" ;
840
+ _gpulib = mlirRoot + " /lib/libmlir_cuda_runtime.so" ;
848
841
if (!std::ifstream (_gpulib)) {
849
- throw std::runtime_error (" Cannot find liblevel-zero-runtime.so " );
842
+ throw std::runtime_error (" Cannot find lib: " + _gpulib );
850
843
}
851
844
}
852
845
_sharedLibPaths = {_crunnerlib.c_str (), _runnerlib.c_str (),
0 commit comments