1*da0073e9SAndroid Build Coastguard Workerload("@rules_cuda//cuda:defs.bzl", "cuda_library") 2*da0073e9SAndroid Build Coastguard Worker 3*da0073e9SAndroid Build Coastguard WorkerNVCC_COPTS = [ 4*da0073e9SAndroid Build Coastguard Worker "--expt-relaxed-constexpr", 5*da0073e9SAndroid Build Coastguard Worker "--expt-extended-lambda", 6*da0073e9SAndroid Build Coastguard Worker "--compiler-options=-Werror=all", 7*da0073e9SAndroid Build Coastguard Worker # The following warnings come from -Wall. We downgrade them from 8*da0073e9SAndroid Build Coastguard Worker # error to warnings here. 9*da0073e9SAndroid Build Coastguard Worker # 10*da0073e9SAndroid Build Coastguard Worker # sign-compare has a tremendous amount of violations in the 11*da0073e9SAndroid Build Coastguard Worker # codebase. It will be a lot of work to fix them, just disable it 12*da0073e9SAndroid Build Coastguard Worker # for now. 13*da0073e9SAndroid Build Coastguard Worker "--compiler-options=-Wno-sign-compare", 14*da0073e9SAndroid Build Coastguard Worker # We intentionally use #pragma unroll, which is compiler specific. 15*da0073e9SAndroid Build Coastguard Worker "--compiler-options=-Wno-error=unknown-pragmas", 16*da0073e9SAndroid Build Coastguard Worker "--compiler-options=-Werror=extra", 17*da0073e9SAndroid Build Coastguard Worker # The following warnings come from -Wextra. We downgrade them from 18*da0073e9SAndroid Build Coastguard Worker # error to warnings here. 19*da0073e9SAndroid Build Coastguard Worker # 20*da0073e9SAndroid Build Coastguard Worker # unused-parameter-compare has a tremendous amount of violations 21*da0073e9SAndroid Build Coastguard Worker # in the codebase. It will be a lot of work to fix them, just 22*da0073e9SAndroid Build Coastguard Worker # disable it for now. 23*da0073e9SAndroid Build Coastguard Worker "--compiler-options=-Wno-unused-parameter", 24*da0073e9SAndroid Build Coastguard Worker # missing-field-parameters has both a large number of violations 25*da0073e9SAndroid Build Coastguard Worker # in the codebase, but it also is used pervasively in the Python C 26*da0073e9SAndroid Build Coastguard Worker # API. There are a couple of catches though: 27*da0073e9SAndroid Build Coastguard Worker # * we use multiple versions of the Python API and hence have 28*da0073e9SAndroid Build Coastguard Worker # potentially multiple different versions of each relevant 29*da0073e9SAndroid Build Coastguard Worker # struct. They may have different numbers of fields. It will be 30*da0073e9SAndroid Build Coastguard Worker # unwieldy to support multiple versions in the same source file. 31*da0073e9SAndroid Build Coastguard Worker # * Python itself for many of these structs recommends only 32*da0073e9SAndroid Build Coastguard Worker # initializing a subset of the fields. We should respect the API 33*da0073e9SAndroid Build Coastguard Worker # usage conventions of our dependencies. 34*da0073e9SAndroid Build Coastguard Worker # 35*da0073e9SAndroid Build Coastguard Worker # Hence, we just disable this warning altogether. We may want to 36*da0073e9SAndroid Build Coastguard Worker # clean up some of the clear-cut cases that could be risky, but we 37*da0073e9SAndroid Build Coastguard Worker # still likely want to have this disabled for the most part. 38*da0073e9SAndroid Build Coastguard Worker "-Wno-missing-field-initializers", 39*da0073e9SAndroid Build Coastguard Worker] 40*da0073e9SAndroid Build Coastguard Worker 41*da0073e9SAndroid Build Coastguard Workerdef cu_library(name, srcs, copts = [], **kwargs): 42*da0073e9SAndroid Build Coastguard Worker cuda_library(name, srcs = srcs, copts = NVCC_COPTS + copts, **kwargs) 43