From 3307a7c046cb591dd628dd739d2f930c6943df3c Mon Sep 17 00:00:00 2001 From: Christian Sigg Date: Tue, 10 Nov 2020 12:56:50 +0100 Subject: [PATCH] [mlir][gpu] Add missing initialization of gpu runtime wrappers. Reviewed By: herhut Differential Revision: https://reviews.llvm.org/D91148 --- mlir/tools/mlir-cuda-runner/cuda-runtime-wrappers.cpp | 1 + mlir/tools/mlir-rocm-runner/rocm-runtime-wrappers.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/mlir/tools/mlir-cuda-runner/cuda-runtime-wrappers.cpp b/mlir/tools/mlir-cuda-runner/cuda-runtime-wrappers.cpp index 5556700..917d203 100644 --- a/mlir/tools/mlir-cuda-runner/cuda-runtime-wrappers.cpp +++ b/mlir/tools/mlir-cuda-runner/cuda-runtime-wrappers.cpp @@ -34,6 +34,7 @@ // Static initialization of CUDA context for device ordinal 0. static auto InitializeCtx = [] { + CUDA_REPORT_IF_ERROR(cuInit(/*flags=*/0)); CUdevice device; CUDA_REPORT_IF_ERROR(cuDeviceGet(&device, /*ordinal=*/0)); CUcontext context; diff --git a/mlir/tools/mlir-rocm-runner/rocm-runtime-wrappers.cpp b/mlir/tools/mlir-rocm-runner/rocm-runtime-wrappers.cpp index d600a3f..882a4a3 100644 --- a/mlir/tools/mlir-rocm-runner/rocm-runtime-wrappers.cpp +++ b/mlir/tools/mlir-rocm-runner/rocm-runtime-wrappers.cpp @@ -33,6 +33,7 @@ // Static initialization of HIP context for device ordinal 0. static auto InitializeCtx = [] { + HIP_REPORT_IF_ERROR(hipInit(/*flags=*/0)); hipDevice_t device; HIP_REPORT_IF_ERROR(hipDeviceGet(&device, /*ordinal=*/0)); hipContext_t context; -- 2.7.4