[mlir] Silence -Wglobal-constructors error in CudaRuntimeWrapper.cpp

Until I have a better solution with dynamic initialization, to get
the nvidia build bot green again.
This commit is contained in:
Christian Sigg 2021-03-03 13:46:03 +01:00
parent 820a846609
commit b6ac26fce5

View file

@ -37,6 +37,8 @@
fprintf(stderr, "'%s' failed with '%s'\n", #expr, name); \ fprintf(stderr, "'%s' failed with '%s'\n", #expr, name); \
}(expr) }(expr)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wglobal-constructors"
// Static reference to CUDA primary context for device ordinal 0. // Static reference to CUDA primary context for device ordinal 0.
static CUcontext Context = [] { static CUcontext Context = [] {
CUDA_REPORT_IF_ERROR(cuInit(/*flags=*/0)); CUDA_REPORT_IF_ERROR(cuInit(/*flags=*/0));
@ -46,6 +48,7 @@ static CUcontext Context = [] {
CUDA_REPORT_IF_ERROR(cuDevicePrimaryCtxRetain(&context, device)); CUDA_REPORT_IF_ERROR(cuDevicePrimaryCtxRetain(&context, device));
return context; return context;
}(); }();
#pragma clang diagnostic pop
// Sets the `Context` for the duration of the instance and restores the previous // Sets the `Context` for the duration of the instance and restores the previous
// context on destruction. // context on destruction.