@@ -688,6 +688,8 @@ static const std::string cpu_pipeline =
688688 " arith-expand,"
689689 " memref-expand,"
690690 " func.func(empty-tensor-to-alloc-tensor),"
691+ " cse,"
692+ " canonicalize,"
691693 " one-shot-bufferize,"
692694 " canonicalize,"
693695 " imex-remove-temporaries,"
@@ -728,53 +730,46 @@ static const std::string gpu_pipeline =
728730 " linalg-fuse-elementwise-ops,"
729731 " arith-expand,"
730732 " memref-expand,"
731- " arith-bufferize,"
732- " func-bufferize,"
733733 " 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}),"
740736 " region-bufferize,"
741737 " canonicalize,"
742- " func.func(finalizing-bufferize),"
738+ " one-shot-bufferize,"
739+ " cse,"
740+ " canonicalize,"
741+ " scf-forall-to-parallel,"
742+ " cse,"
743+ " canonicalize,"
743744 " 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),"
748747 " 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),"
752753 " drop-regions,"
753754 " canonicalize,"
754- // "normalize-memrefs,"
755- // "gpu-decompose-memrefs,"
756- " func.func(lower-affine),"
757755 " gpu-kernel-outlining,"
756+ " convert-scf-to-cf,"
757+ " convert-cf-to-llvm,"
758758 " canonicalize,"
759759 " 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),"
771764 " expand-strided-metadata,"
772765 " lower-affine,"
773- " convert- gpu-to-gpux ,"
766+ " gpu-to-llvm ,"
774767 " convert-func-to-llvm,"
775768 " convert-math-to-llvm,"
776- " convert-gpux-to-llvm,"
777769 " finalize-memref-to-llvm,"
770+ " canonicalize,"
771+ " cse,"
772+ " gpu-module-to-binary{format=fatbin},"
778773 " reconcile-unrealized-casts" ;
779774
780775const std::string _passes (get_text_env (" SHARPY_PASSES" ));
@@ -831,22 +826,20 @@ JIT::JIT(const std::string &libidtr)
831826 _crunnerlib = mlirRoot + " /lib/libmlir_c_runner_utils.so" ;
832827 _runnerlib = mlirRoot + " /lib/libmlir_runner_utils.so" ;
833828 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 );
835830 }
836831 if (!std::ifstream (_runnerlib)) {
837- throw std::runtime_error (" Cannot find libmlir_runner_utils.so " );
832+ throw std::runtime_error (" Cannot find lib: " + _runnerlib );
838833 }
839834
840835 if (useGPU ()) {
841836 auto gpuxlibstr = get_text_env (" SHARPY_GPUX_SO" );
842837 if (!gpuxlibstr.empty ()) {
843838 _gpulib = std::string (gpuxlibstr);
844839 } 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" ;
848841 if (!std::ifstream (_gpulib)) {
849- throw std::runtime_error (" Cannot find liblevel-zero-runtime.so " );
842+ throw std::runtime_error (" Cannot find lib: " + _gpulib );
850843 }
851844 }
852845 _sharedLibPaths = {_crunnerlib.c_str (), _runnerlib.c_str (),
0 commit comments