Skip to content

Commit

Permalink
More warning squishing
Browse files Browse the repository at this point in the history
  • Loading branch information
RossBrunton committed Sep 23, 2024
1 parent 9ca3ec7 commit 8b5315d
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 16 deletions.
1 change: 1 addition & 0 deletions source/adapters/cuda/enqueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunchCustomExp(
}
return UR_RESULT_SUCCESS;
#else
[[maybe_unused]] auto _ = launchPropList;
setErrorMessage("This feature requires cuda 11.8 or later.",
UR_RESULT_ERROR_ADAPTER_SPECIFIC);
return UR_RESULT_ERROR_ADAPTER_SPECIFIC;
Expand Down
24 changes: 14 additions & 10 deletions source/adapters/cuda/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ ur_result_t urTextureCreate(ur_sampler_handle_t hSampler,
#if CUDA_VERSION >= 11060
ImageTexDesc.flags |= CU_TRSF_SEAMLESS_CUBEMAP;
#else
setErrorMessage("The " UR_EXP_SAMPLER_CUBEMAP_FILTER_MODE_SEAMLESS
" feature requires cuda 11.6 or later.",
setErrorMessage("The EXP_SAMPLER_CUBEMAP_FILTER_MODE_SEAMLESS"
"feature requires cuda 11.6 or later.",
UR_RESULT_ERROR_ADAPTER_SPECIFIC);
return UR_RESULT_ERROR_ADAPTER_SPECIFIC;
#endif
Expand Down Expand Up @@ -657,6 +657,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
UR_ASSERT(pSrcImageFormat->channelOrder == pDstImageFormat->channelOrder,
UR_RESULT_ERROR_INVALID_ARGUMENT);

auto as_CUArray = [](const void *ptr) {
return static_cast<CUarray>(const_cast<void *>(ptr));
};

unsigned int NumChannels = 0;
size_t PixelSizeBytes = 0;

Expand Down Expand Up @@ -785,7 +789,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(

if (isCudaArray) {
UR_CHECK_ERROR(
cuMemcpyAtoHAsync(DstWithOffset, (CUarray)pSrc,
cuMemcpyAtoHAsync(DstWithOffset, as_CUArray(pSrc),
PixelSizeBytes * pCopyRegion->srcOffset.x,
CopyExtentBytes, Stream));
} else if (memType == CU_MEMORYTYPE_DEVICE) {
Expand All @@ -809,7 +813,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
cpy_desc.dstHost = pDst;
if (pSrcImageDesc->rowPitch == 0) {
cpy_desc.srcMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_ARRAY;
cpy_desc.srcArray = (CUarray)pSrc;
cpy_desc.srcArray = as_CUArray(pSrc);
} else {
// Pitched memory
cpy_desc.srcMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_DEVICE;
Expand All @@ -831,7 +835,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
cpy_desc.dstY = pCopyRegion->dstOffset.y;
cpy_desc.dstZ = pCopyRegion->dstOffset.z;
cpy_desc.srcMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_ARRAY;
cpy_desc.srcArray = (CUarray)pSrc;
cpy_desc.srcArray = as_CUArray(pSrc);
cpy_desc.dstMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_HOST;
cpy_desc.dstHost = pDst;
cpy_desc.dstPitch = pDstImageDesc->width * PixelSizeBytes;
Expand All @@ -851,7 +855,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
cpy_desc.dstY = pCopyRegion->dstOffset.y;
cpy_desc.dstZ = pCopyRegion->dstOffset.z;
cpy_desc.srcMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_ARRAY;
cpy_desc.srcArray = (CUarray)pSrc;
cpy_desc.srcArray = as_CUArray(pSrc);
cpy_desc.dstMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_HOST;
cpy_desc.dstHost = pDst;
cpy_desc.dstPitch = pDstImageDesc->width * PixelSizeBytes;
Expand Down Expand Up @@ -881,7 +885,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
cpy_desc.dstXInBytes = pCopyRegion->dstOffset.x * PixelSizeBytes;
cpy_desc.dstY = 0;
cpy_desc.srcMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_ARRAY;
cpy_desc.srcArray = (CUarray)pSrc;
cpy_desc.srcArray = as_CUArray(pSrc);
cpy_desc.dstMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_ARRAY;
cpy_desc.dstArray = (CUarray)pDst;
cpy_desc.WidthInBytes = PixelSizeBytes * pCopyRegion->copyExtent.width;
Expand All @@ -894,7 +898,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
cpy_desc.dstXInBytes = pCopyRegion->dstOffset.x * PixelSizeBytes;
cpy_desc.dstY = pCopyRegion->dstOffset.y;
cpy_desc.srcMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_ARRAY;
cpy_desc.srcArray = (CUarray)pSrc;
cpy_desc.srcArray = as_CUArray(pSrc);
cpy_desc.dstMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_ARRAY;
cpy_desc.dstArray = (CUarray)pDst;
cpy_desc.WidthInBytes = PixelSizeBytes * pCopyRegion->copyExtent.width;
Expand All @@ -909,7 +913,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
cpy_desc.dstY = pCopyRegion->dstOffset.y;
cpy_desc.dstZ = pCopyRegion->dstOffset.z;
cpy_desc.srcMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_ARRAY;
cpy_desc.srcArray = (CUarray)pSrc;
cpy_desc.srcArray = as_CUArray(pSrc);
cpy_desc.dstMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_ARRAY;
cpy_desc.dstArray = (CUarray)pDst;
cpy_desc.WidthInBytes = PixelSizeBytes * pCopyRegion->copyExtent.width;
Expand All @@ -927,7 +931,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
cpy_desc.dstY = pCopyRegion->dstOffset.y;
cpy_desc.dstZ = pCopyRegion->dstOffset.z;
cpy_desc.srcMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_ARRAY;
cpy_desc.srcArray = (CUarray)pSrc;
cpy_desc.srcArray = as_CUArray(pSrc);
cpy_desc.dstMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_ARRAY;
cpy_desc.dstArray = (CUarray)pDst;
cpy_desc.WidthInBytes = PixelSizeBytes * pCopyRegion->copyExtent.width;
Expand Down
4 changes: 3 additions & 1 deletion source/adapters/cuda/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "memory.hpp"
#include "queue.hpp"
#include "sampler.hpp"
#include "ur_api.h"

UR_APIEXPORT ur_result_t UR_APICALL
urKernelCreate(ur_program_handle_t hProgram, const char *pKernelName,
Expand Down Expand Up @@ -343,7 +344,8 @@ urKernelSetArgMemObj(ur_kernel_handle_t hKernel, uint32_t argIndex,
try {
auto Device = hKernel->getProgram()->getDevice();
ur_mem_flags_t MemAccess =
Properties ? Properties->memoryAccess : UR_MEM_FLAG_READ_WRITE;
Properties ? Properties->memoryAccess
: static_cast<ur_mem_flags_t>(UR_MEM_FLAG_READ_WRITE);
hKernel->Args.addMemObjArg(argIndex, hArgValue, MemAccess);
if (hArgValue->isImage()) {
CUDA_ARRAY3D_DESCRIPTOR arrayDesc;
Expand Down
2 changes: 1 addition & 1 deletion source/adapters/hip/usm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ urUSMGetMemAllocInfo(ur_context_handle_t hContext, const void *pMem,
void *Base = nullptr;
UR_CHECK_ERROR(hipPointerGetAttribute(
&Base, HIP_POINTER_ATTRIBUTE_RANGE_START_ADDR,
(hipDeviceptr_t)pMem));
reinterpret_cast<const hipDeviceptr_t *>(pMem)));
return ReturnValue(Base);
}
}
Expand Down
5 changes: 2 additions & 3 deletions source/loader/ur_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ void context_t::parseEnvEnabledLayers() {
}
}

void context_t::initLayers() const {
void context_t::initLayers() {
for (auto &[layer, _] : layers) {
layer->init((ur_dditable_t *)&urDdiTable, enabledLayerNames,
codelocData);
layer->init(&urDdiTable, enabledLayerNames, codelocData);
}
}

Expand Down
2 changes: 1 addition & 1 deletion source/loader/ur_lib.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class __urdlllocal context_t : public AtomicSingleton<context_t> {
codeloc_data codelocData;

void parseEnvEnabledLayers();
void initLayers() const;
void initLayers();
void tearDownLayers() const;
};

Expand Down

0 comments on commit 8b5315d

Please sign in to comment.