Skip to content

Commit

Permalink
Merge branch 'adapters' into merge-some-main-changes-into-adapters-th…
Browse files Browse the repository at this point in the history
…ird-patch
  • Loading branch information
omarahmed1111 committed Nov 30, 2023
2 parents a92a989 + a99d1db commit d4180c1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -283,15 +283,19 @@ jobs:
{name: None, var: ''}, {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'}
]

# TODO: building level zero loader on windows-2019 is currently broken
exclude:
- os: 'windows-2019'
adapter: {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'}
build_type: [Debug, Release]
compiler: [{c: cl, cxx: cl}, {c: clang-cl, cxx: clang-cl}]
include:
- compiler: {c: clang-cl, cxx: clang-cl}
toolset: "-T ClangCL"

# TODO: building level zero loader on windows-2019 and clang-cl.exe is currently broken
exclude:
- os: 'windows-2019'
adapter: {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'}
- adapter: {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'}
compiler: {c: clang-cl.exe, cxx: clang-cl.exe}

runs-on: ${{matrix.os}}

steps:
Expand Down
14 changes: 11 additions & 3 deletions source/adapters/hip/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory,
UR_CHECK_ERROR(hipMemGetAddressRange(&BasePtr, &AllocSize, Mem.Ptr));
return AllocSize;
} else if constexpr (std::is_same_v<T, SurfaceMem>) {
#if HIP_VERSION < 50600000
throw UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
#else
HIP_ARRAY3D_DESCRIPTOR ArrayDescriptor;
UR_CHECK_ERROR(hipArray3DGetDescriptor(&ArrayDescriptor, Mem.Array));
UR_CHECK_ERROR(
hipArray3DGetDescriptor(&ArrayDescriptor, Mem.getArray()));
const auto PixelSizeBytes =
GetHipFormatPixelSize(ArrayDescriptor.Format) *
ArrayDescriptor.NumChannels;
Expand All @@ -284,6 +288,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory,
(ArrayDescriptor.Height ? ArrayDescriptor.Height : 1) *
(ArrayDescriptor.Depth ? ArrayDescriptor.Depth : 1);
return ImageSizeBytes;
#endif
} else {
static_assert(ur_always_false_t<T>, "Not exhaustive visitor!");
}
Expand Down Expand Up @@ -535,10 +540,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemImageGetInfo(ur_mem_handle_t hMemory,
UrReturnHelper ReturnValue(propSize, pPropValue, pPropSizeRet);

try {

HIP_ARRAY3D_DESCRIPTOR ArrayInfo;
#if HIP_VERSION >= 50600000
UR_CHECK_ERROR(hipArray3DGetDescriptor(
&ArrayInfo, std::get<SurfaceMem>(hMemory->Mem).Array));
&ArrayInfo, std::get<SurfaceMem>(hMemory->Mem).getArray()));
#else
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
#endif

const auto hip2urFormat =
[](hipArray_Format HipFormat) -> ur_image_channel_type_t {
Expand Down

0 comments on commit d4180c1

Please sign in to comment.