Skip to content

Commit 9efec19

Browse files
committed
remove intel gpu pipeline
- setting SHARPY_DEVICE implies we are targeting nvidia gpu - IMEXROOT env variable is not used anymore
1 parent 733cd26 commit 9efec19

File tree

2 files changed

+2
-81
lines changed

2 files changed

+2
-81
lines changed

src/include/sharpy/UtilsAndTypes.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,3 @@ inline bool useGPU() {
7070
auto device = get_text_env("SHARPY_DEVICE");
7171
return !(device.empty() || device == "host" || device == "cpu");
7272
}
73-
74-
inline bool useCUDA() { return get_bool_env("SHARPY_USE_CUDA"); }

src/jit/mlir.cpp

Lines changed: 2 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -709,75 +709,6 @@ static const std::string cpu_pipeline =
709709
"reconcile-unrealized-casts";
710710

711711
static const std::string gpu_pipeline =
712-
"add-gpu-regions,"
713-
"canonicalize,"
714-
"ndarray-dist,"
715-
"func.func(dist-coalesce),"
716-
"func.func(dist-infer-elementwise-cores),"
717-
"convert-dist-to-standard,"
718-
"canonicalize,"
719-
"overlap-comm-and-compute,"
720-
"add-comm-cache-keys,"
721-
"lower-distruntime-to-idtr,"
722-
"convert-ndarray-to-linalg,"
723-
"canonicalize,"
724-
"func.func(tosa-make-broadcastable),"
725-
"func.func(tosa-to-linalg),"
726-
"func.func(tosa-to-tensor),"
727-
"canonicalize,"
728-
"linalg-fuse-elementwise-ops,"
729-
"arith-expand,"
730-
"memref-expand,"
731-
"arith-bufferize,"
732-
"func-bufferize,"
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),"
740-
"region-bufferize,"
741-
"canonicalize,"
742-
"func.func(finalizing-bufferize),"
743-
"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),"
748-
"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}),"
752-
"drop-regions,"
753-
"canonicalize,"
754-
// "normalize-memrefs,"
755-
// "gpu-decompose-memrefs,"
756-
"func.func(lower-affine),"
757-
"gpu-kernel-outlining,"
758-
"canonicalize,"
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,"
771-
"expand-strided-metadata,"
772-
"lower-affine,"
773-
"convert-gpu-to-gpux,"
774-
"convert-func-to-llvm,"
775-
"convert-math-to-llvm,"
776-
"convert-gpux-to-llvm,"
777-
"finalize-memref-to-llvm,"
778-
"reconcile-unrealized-casts";
779-
780-
static const std::string cuda_pipeline =
781712
"add-gpu-regions,"
782713
"canonicalize,"
783714
"ndarray-dist,"
@@ -838,9 +769,7 @@ static const std::string cuda_pipeline =
838769

839770
const std::string _passes(get_text_env("SHARPY_PASSES"));
840771
static const std::string &pass_pipeline =
841-
_passes != "" ? _passes
842-
: (useGPU() ? (useCUDA() ? cuda_pipeline : gpu_pipeline)
843-
: cpu_pipeline);
772+
_passes != "" ? _passes : (useGPU() ? gpu_pipeline : cpu_pipeline);
844773

845774
JIT::JIT(const std::string &libidtr)
846775
: _context(::mlir::MLIRContext::Threading::DISABLED), _pm(&_context),
@@ -903,13 +832,7 @@ JIT::JIT(const std::string &libidtr)
903832
if (!gpuxlibstr.empty()) {
904833
_gpulib = std::string(gpuxlibstr);
905834
} else {
906-
if (useCUDA()) {
907-
_gpulib = mlirRoot + "/lib/libmlir_cuda_runtime.so";
908-
} else {
909-
auto imexRoot = get_text_env("IMEXROOT");
910-
imexRoot = !imexRoot.empty() ? imexRoot : std::string(CMAKE_IMEX_ROOT);
911-
_gpulib = imexRoot + "/lib/liblevel-zero-runtime.so";
912-
}
835+
_gpulib = mlirRoot + "/lib/libmlir_cuda_runtime.so";
913836
if (!std::ifstream(_gpulib)) {
914837
throw std::runtime_error("Cannot find lib: " + _gpulib);
915838
}

0 commit comments

Comments
 (0)