-
Notifications
You must be signed in to change notification settings - Fork 797
[SYCL][CUDA] Port CUDA plugin to Unified Runtime #9512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
da70781
[SYCL][CUDA] Export loader interface for CUDA UR adapter
46dca60
[SYCL][PI][UR][CUDA] Port CUDA platform, device, context to Unified R…
callumfare 8073f6c
Port program and kernel entry points
omarahmed1111 506130e
Add UR_KERNEL_GROUP_INFO_GLOBAL_WORK_SIZE to kernel group info
omarahmed1111 625f1f8
[SYCL][PI][UR][CUDA] Port a few miscellaneous CUDA entry points to UR
callumfare 3ae2329
[SYCL][PI][UR][CUDA] Port CUDA queue and event to Unified Runtime
callumfare 103cec3
AAdd program and kernel ddi tables
omarahmed1111 c640339
[SYCL][PI][UR][CUDA] Port piEnqueueKernelLaunch to UR
callumfare 8c63247
[SYCL][CUDA][UR] Add missing queue/event entry points to DDI table
callumfare 76d4c5f
[SYCL][CUDA] Remove unused function from pi_cuda
callumfare 3742495
[SYCL][CUDA] Add missing UR_APICALL, UR_APIEXPORT to entry points
callumfare 7e0f0ec
Small fixes
17f91fc
[SYCL][PI][UR][CUDA] Port CUDA sampler to UR
callumfare 6489ce1
[SYCL][CUDA] Fix missing input validation for various queue entry points
callumfare ebe90a2
Refactor memory object and entry points into new memory.hpp/cpp files…
martygrant ef9f224
Port USM entry points
omarahmed1111 d185543
[UR][CUDA][SYCL] Fix sycl-e2e tests
398f3e9
[UR][CUDA] Port urEnqueueRead/Write & setArgMemObj
e02d3d3
Port piextKernelSetArgSampler
omarahmed1111 816652a
[UR][SYCL][CUDA] Point PI to correct entry point
6d648f6
Port remaining queue entry-points
omarahmed1111 4f9277b
Don't check MAX_MEM_ALLOC_SIZE when creating a buffer
callumfare 8968c1f
[SYCL][CUDA] Port CUDA global variable read/write to UR
callumfare 1fb2afd
[SYCL][CUDA] Only build CUDA UR adapter when CUDA plugin is enabled
callumfare 96c85ac
[SYCL][CUDA] Don't link non-CUDA adapters with cudadrv
callumfare 3812978
[SYCL][CUDA] Port piextGetDeviceFunctionPointer and piextDeviceSelect…
callumfare 764e683
[SYCL][CUDA] Port piPluginGetBackendOption to UR
callumfare d98adf8
[SYCL][CUDA] Port read/write host pipe to UR
callumfare 797d3f7
[CUDA][UR]Fix program_info_kernel_names
omarahmed1111 6f68c7c
[SYCL][CUDA] Remove unused code from CUDA PI and move remaining docum…
callumfare ff2559f
[SYCL][CUDA] Add a few extra checks to the cuda UR program implementa…
aarongreig d69f029
[SYCL][CUDA] Implement UR_DEVICE_INFO_IL_VERSION query for cuda.
aarongreig 190f3c7
[SYCL][CUDA][UR] Remove queue backward compatability apis
omarahmed1111 a441503
[SYCL][CUDA][UR] Add usmPool entry points to ddi tables and fix ur*na…
omarahmed1111 3b65369
Fix CUDA adapter formatting
callumfare 0011b91
Mark KernelFusion/sync_two_queues_event_dep as unsupported on cuda pe…
callumfare 9e97af7
[SYCL][CUDA] Fix assumption about work dimensions in EnqueueKernelLau…
aarongreig b538dd8
[SYCL][CUDA] Correct return type of cuda USM capability queries.
aarongreig 9811f9b
[SYCL][CUDA] A number of small cuda adapter fixes for cts/spec compli…
aarongreig fce479c
[SYCL][UR] Avoid zero-length new in pi2ur.
aarongreig 9b3448a
[SYCL][CUDA] Mass fixup of code style in the CUDA adapter
callumfare a0de2d7
[SYCL][CUDA][PI][UR] Fix PR review comments
2a50972
[SYCL][CUDA] Tidy CMakeLists.txt
callumfare c39e794
Fix various build warnings
callumfare b64fcbd
Address more review feedback
callumfare File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[SYCL][PI][UR][CUDA] Port CUDA sampler to UR
- Loading branch information
commit 17f91fc331e90b29065db3b2c4c7f5d170bb9ab3
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
//===--------- sampler.cpp - CUDA Adapter ----------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===-----------------------------------------------------------------===// | ||
|
||
#include "sampler.hpp" | ||
#include "common.hpp" | ||
|
||
ur_result_t urSamplerCreate(ur_context_handle_t hContext, | ||
const ur_sampler_desc_t *pDesc, | ||
ur_sampler_handle_t *phSampler) { | ||
std::unique_ptr<ur_sampler_handle_t_> retImplSampl{ | ||
new ur_sampler_handle_t_(hContext)}; | ||
|
||
if (pDesc && pDesc->stype == UR_STRUCTURE_TYPE_SAMPLER_DESC) { | ||
retImplSampl->props_ |= pDesc->normalizedCoords; | ||
retImplSampl->props_ |= (pDesc->filterMode << 1); | ||
retImplSampl->props_ |= (pDesc->addressingMode << 2); | ||
callumfare marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} else { | ||
// Set default values | ||
retImplSampl->props_ |= true; // Normalized Coords | ||
retImplSampl->props_ |= UR_SAMPLER_ADDRESSING_MODE_CLAMP << 2; | ||
} | ||
|
||
*phSampler = retImplSampl.release(); | ||
return UR_RESULT_SUCCESS; | ||
} | ||
|
||
ur_result_t urSamplerGetInfo(ur_sampler_handle_t hSampler, | ||
ur_sampler_info_t propName, size_t propValueSize, | ||
void *pPropValue, size_t *pPropSizeRet) { | ||
UR_ASSERT(hSampler, UR_RESULT_ERROR_INVALID_NULL_HANDLE); | ||
UrReturnHelper ReturnValue(propValueSize, pPropValue, pPropSizeRet); | ||
|
||
switch (propName) { | ||
case UR_SAMPLER_INFO_REFERENCE_COUNT: | ||
return ReturnValue(hSampler->get_reference_count()); | ||
case UR_SAMPLER_INFO_CONTEXT: | ||
return ReturnValue(hSampler->context_); | ||
case UR_SAMPLER_INFO_NORMALIZED_COORDS: { | ||
bool norm_coords_prop = static_cast<bool>(hSampler->props_); | ||
return ReturnValue(norm_coords_prop); | ||
} | ||
case UR_SAMPLER_INFO_FILTER_MODE: { | ||
auto filter_prop = | ||
static_cast<ur_sampler_filter_mode_t>(((hSampler->props_ >> 1) & 0x1)); | ||
callumfare marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return ReturnValue(filter_prop); | ||
} | ||
case UR_SAMPLER_INFO_ADDRESSING_MODE: { | ||
auto addressing_prop = | ||
static_cast<ur_sampler_addressing_mode_t>(hSampler->props_ >> 2); | ||
return ReturnValue(addressing_prop); | ||
} | ||
default: | ||
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; | ||
} | ||
return {}; | ||
} | ||
|
||
ur_result_t urSamplerRetain(ur_sampler_handle_t hSampler) { | ||
UR_ASSERT(hSampler, UR_RESULT_ERROR_INVALID_NULL_HANDLE); | ||
hSampler->increment_reference_count(); | ||
return UR_RESULT_SUCCESS; | ||
} | ||
|
||
ur_result_t urSamplerRelease(ur_sampler_handle_t hSampler) { | ||
UR_ASSERT(hSampler, UR_RESULT_ERROR_INVALID_NULL_HANDLE); | ||
|
||
// double delete or someone is messing with the ref count. | ||
// either way, cannot safely proceed. | ||
sycl::detail::ur::assertion( | ||
hSampler->get_reference_count() != 0, | ||
"Reference count overflow detected in urSamplerRelease."); | ||
|
||
// decrement ref count. If it is 0, delete the sampler. | ||
if (hSampler->decrement_reference_count() == 0) { | ||
delete hSampler; | ||
} | ||
|
||
return UR_RESULT_SUCCESS; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//===--------- sampler.hpp - CUDA Adapter ----------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===-----------------------------------------------------------------===// | ||
|
||
#include <ur/ur.hpp> | ||
|
||
/// Implementation of samplers for CUDA | ||
/// | ||
/// Sampler property layout: | ||
/// | 31 30 ... 6 5 | 4 3 2 | 1 | 0 | | ||
/// | N/A | addressing mode | fiter mode | normalize coords | | ||
struct ur_sampler_handle_t_ { | ||
std::atomic_uint32_t refCount_; | ||
uint32_t props_; | ||
ur_context_handle_t context_; | ||
|
||
ur_sampler_handle_t_(ur_context_handle_t context) | ||
: refCount_(1), props_(0), context_(context) {} | ||
|
||
uint32_t increment_reference_count() noexcept { return ++refCount_; } | ||
|
||
uint32_t decrement_reference_count() noexcept { return --refCount_; } | ||
|
||
uint32_t get_reference_count() const noexcept { return refCount_; } | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.