diff --git a/.github/workflows/benchmarks-reusable.yml b/.github/workflows/benchmarks-reusable.yml
index 46bdecb4ca..83c05f896c 100644
--- a/.github/workflows/benchmarks-reusable.yml
+++ b/.github/workflows/benchmarks-reusable.yml
@@ -236,3 +236,8 @@ jobs:
with:
path: ur-repo/benchmark_results.html
key: benchmark-results-${{ matrix.adapter.str_name }}-${{ github.run_id }}
+
+ - name: Get information about platform
+ if: ${{ always() }}
+ working-directory: ${{ github.workspace }}/ur-repo/
+ run: .github/scripts/get_system_info.sh
diff --git a/.github/workflows/e2e_core.yml b/.github/workflows/e2e_core.yml
index f12913c648..c98ec21288 100644
--- a/.github/workflows/e2e_core.yml
+++ b/.github/workflows/e2e_core.yml
@@ -192,6 +192,11 @@ jobs:
id: tests
run: ninja -C build-e2e check-sycl-e2e || echo "e2e tests have failed. Ignoring failure."
+ - name: Get information about platform
+ if: ${{ always() }}
+ working-directory: ${{github.workspace}}/ur-repo
+ run: .github/scripts/get_system_info.sh
+
# FIXME: Requires pull-request: write permissions but this is only granted
# on pull requests from forks if using pull_request_target workflow
# trigger but not the pull_request trigger..
diff --git a/README.md b/README.md
index 459b75398a..2b555702b9 100644
--- a/README.md
+++ b/README.md
@@ -76,7 +76,14 @@ history to avoid pulling potentially breaking changes from the `main` branch.
## Third-Party tools
-Tools can be acquired via instructions in [third_party](/third_party/README.md).
+The recommended method to install the third-party tools is using a Python
+virtual environment, for example:
+
+```bash
+$ python -m venv .venv
+$ source .venv/bin/activate
+$ pip install -r third_party/requirements.txt
+```
## Building
diff --git a/include/ur_api.h b/include/ur_api.h
index 60f220f4a2..15cfb09e82 100644
--- a/include/ur_api.h
+++ b/include/ur_api.h
@@ -9543,6 +9543,7 @@ urEnqueueCooperativeKernelLaunchExp(
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `NULL == hKernel`
+/// + `NULL == hDevice`
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
/// + `NULL == pLocalWorkSize`
/// + `NULL == pGroupCountRet`
@@ -9550,6 +9551,7 @@ urEnqueueCooperativeKernelLaunchExp(
UR_APIEXPORT ur_result_t UR_APICALL
urKernelSuggestMaxCooperativeGroupCountExp(
ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object
+ ur_device_handle_t hDevice, ///< [in] handle of the device object
uint32_t workDim, ///< [in] number of dimensions, from 1 to 3, to specify the work-group
///< work-items
const size_t *pLocalWorkSize, ///< [in] pointer to an array of workDim unsigned values that specify the
@@ -11090,6 +11092,7 @@ typedef struct ur_kernel_set_specialization_constants_params_t {
/// allowing the callback the ability to modify the parameter's value
typedef struct ur_kernel_suggest_max_cooperative_group_count_exp_params_t {
ur_kernel_handle_t *phKernel;
+ ur_device_handle_t *phDevice;
uint32_t *pworkDim;
const size_t **ppLocalWorkSize;
size_t *pdynamicSharedMemorySize;
diff --git a/include/ur_ddi.h b/include/ur_ddi.h
index 0f8dfabc67..4f6c7ed85b 100644
--- a/include/ur_ddi.h
+++ b/include/ur_ddi.h
@@ -651,6 +651,7 @@ typedef ur_result_t(UR_APICALL *ur_pfnGetKernelProcAddrTable_t)(
/// @brief Function-pointer for urKernelSuggestMaxCooperativeGroupCountExp
typedef ur_result_t(UR_APICALL *ur_pfnKernelSuggestMaxCooperativeGroupCountExp_t)(
ur_kernel_handle_t,
+ ur_device_handle_t,
uint32_t,
const size_t *,
size_t,
diff --git a/include/ur_print.hpp b/include/ur_print.hpp
index 174932fce2..c350f206c6 100644
--- a/include/ur_print.hpp
+++ b/include/ur_print.hpp
@@ -13203,6 +13203,12 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct
ur::details::printPtr(os,
*(params->phKernel));
+ os << ", ";
+ os << ".hDevice = ";
+
+ ur::details::printPtr(os,
+ *(params->phDevice));
+
os << ", ";
os << ".workDim = ";
diff --git a/scripts/benchmarks/benches/result.py b/scripts/benchmarks/benches/result.py
index aa1459cbb3..dfa270689f 100644
--- a/scripts/benchmarks/benches/result.py
+++ b/scripts/benchmarks/benches/result.py
@@ -27,7 +27,7 @@ class Result:
lower_is_better: bool = True
git_hash: str = ""
date: Optional[datetime] = None
- suite: str = ""
+ suite: str = "Unknown"
@dataclass_json
@dataclass
diff --git a/scripts/benchmarks/benchmark_results.html.template b/scripts/benchmarks/benchmark_results.html.template
new file mode 100644
index 0000000000..1deeedad66
--- /dev/null
+++ b/scripts/benchmarks/benchmark_results.html.template
@@ -0,0 +1,192 @@
+
+
+
+
+
+ Benchmark Results
+
+
+
+
+
+
Benchmark Results
+
+
+
+
+ ${suite_checkboxes_html}
+
+
+ Historical Results
+
+ ${timeseries_charts_html}
+
+
+
+ Comparisons
+
+ ${bar_charts_html}
+
+
+
+
+
diff --git a/scripts/benchmarks/output_html.py b/scripts/benchmarks/output_html.py
index 35072a72b4..9c09602354 100644
--- a/scripts/benchmarks/output_html.py
+++ b/scripts/benchmarks/output_html.py
@@ -11,6 +11,7 @@
import matplotlib.dates as mdates
from benches.result import BenchmarkRun, Result
import numpy as np
+from string import Template
@dataclass
class BenchmarkMetadata:
@@ -255,198 +256,14 @@ def generate_html(benchmark_runs: list[BenchmarkRun], github_repo: str, compare_
suite_names = {t.suite for t in timeseries}
suite_checkboxes_html = ' '.join(f'' for suite in suite_names)
- html_template = f"""
-
-
-
-
-
- Benchmark Results
-
-
-
-
-
-
Benchmark Results
-
-
-
-
- {suite_checkboxes_html}
-
-
- Historical Results
-
- {timeseries_charts_html}
-
-
-
- Comparisons
-
- {bar_charts_html}
-
-
-
-
-
- """
- return html_template
+ with open('benchmark_results.html.template', 'r') as file:
+ html_template = file.read()
+
+ template = Template(html_template)
+ data = {
+ 'suite_checkboxes_html': suite_checkboxes_html,
+ 'timeseries_charts_html': timeseries_charts_html,
+ 'bar_charts_html': bar_charts_html,
+ }
+
+ return template.substitute(data)
diff --git a/scripts/core/exp-cooperative-kernels.yml b/scripts/core/exp-cooperative-kernels.yml
index ad3ba0ffba..6020ca5f45 100644
--- a/scripts/core/exp-cooperative-kernels.yml
+++ b/scripts/core/exp-cooperative-kernels.yml
@@ -78,6 +78,9 @@ params:
- type: $x_kernel_handle_t
name: hKernel
desc: "[in] handle of the kernel object"
+ - type: $x_device_handle_t
+ name: hDevice
+ desc: "[in] handle of the device object"
- type: uint32_t
name: workDim
desc: "[in] number of dimensions, from 1 to 3, to specify the work-group work-items"
diff --git a/source/adapters/cuda/command_buffer.cpp b/source/adapters/cuda/command_buffer.cpp
index 9d54422981..35dce59002 100644
--- a/source/adapters/cuda/command_buffer.cpp
+++ b/source/adapters/cuda/command_buffer.cpp
@@ -236,16 +236,29 @@ static ur_result_t enqueueCommandBufferFillHelper(
EventWaitList));
}
+ // CUDA has no memset functions that allow setting values more than 4
+ // bytes. UR API lets you pass an arbitrary "pattern" to the buffer
+ // fill, which can be more than 4 bytes. Calculate the number of steps
+ // required here to see if decomposing to multiple fill nodes is required.
+ size_t NumberOfSteps = PatternSize / sizeof(uint8_t);
+
// Graph node added to graph, if multiple nodes are created this will
// be set to the leaf node
CUgraphNode GraphNode;
+ // Track if multiple nodes are created so we can pass them to the command
+ // handle
+ std::vector DecomposedNodes;
+
+ if (NumberOfSteps > 4) {
+ DecomposedNodes.reserve(NumberOfSteps);
+ }
const size_t N = Size / PatternSize;
auto DstPtr = DstType == CU_MEMORYTYPE_DEVICE
? *static_cast(DstDevice)
: (CUdeviceptr)DstDevice;
- if ((PatternSize == 1) || (PatternSize == 2) || (PatternSize == 4)) {
+ if (NumberOfSteps <= 4) {
CUDA_MEMSET_NODE_PARAMS NodeParams = {};
NodeParams.dst = DstPtr;
NodeParams.elementSize = PatternSize;
@@ -276,14 +289,9 @@ static ur_result_t enqueueCommandBufferFillHelper(
&GraphNode, CommandBuffer->CudaGraph, DepsList.data(), DepsList.size(),
&NodeParams, CommandBuffer->Device->getNativeContext()));
} else {
- // CUDA has no memset functions that allow setting values more than 4
- // bytes. UR API lets you pass an arbitrary "pattern" to the buffer
- // fill, which can be more than 4 bytes. We must break up the pattern
- // into 1 byte values, and set the buffer using multiple strided calls.
- // This means that one cuGraphAddMemsetNode call is made for every 1
- // bytes in the pattern.
-
- size_t NumberOfSteps = PatternSize / sizeof(uint8_t);
+ // We must break up the rest of the pattern into 1 byte values, and set
+ // the buffer using multiple strided calls. This means that one
+ // cuGraphAddMemsetNode call is made for every 1 bytes in the pattern.
// Update NodeParam
CUDA_MEMSET_NODE_PARAMS NodeParamsStepFirst = {};
@@ -294,12 +302,13 @@ static ur_result_t enqueueCommandBufferFillHelper(
NodeParamsStepFirst.value = *static_cast(Pattern);
NodeParamsStepFirst.width = 1;
+ // Inital decomposed node depends on the provided external event wait
+ // nodes
UR_CHECK_ERROR(cuGraphAddMemsetNode(
&GraphNode, CommandBuffer->CudaGraph, DepsList.data(), DepsList.size(),
&NodeParamsStepFirst, CommandBuffer->Device->getNativeContext()));
- DepsList.clear();
- DepsList.push_back(GraphNode);
+ DecomposedNodes.push_back(GraphNode);
// we walk up the pattern in 1-byte steps, and call cuMemset for each
// 1-byte chunk of the pattern.
@@ -319,13 +328,16 @@ static ur_result_t enqueueCommandBufferFillHelper(
NodeParamsStep.value = Value;
NodeParamsStep.width = 1;
+ // Copy the last GraphNode ptr so we can pass it as the dependency for
+ // the next one
+ CUgraphNode PrevNode = GraphNode;
+
UR_CHECK_ERROR(cuGraphAddMemsetNode(
- &GraphNode, CommandBuffer->CudaGraph, DepsList.data(),
- DepsList.size(), &NodeParamsStep,
+ &GraphNode, CommandBuffer->CudaGraph, &PrevNode, 1, &NodeParamsStep,
CommandBuffer->Device->getNativeContext()));
- DepsList.clear();
- DepsList.push_back(GraphNode);
+ // Store the decomposed node
+ DecomposedNodes.push_back(GraphNode);
}
}
@@ -344,7 +356,8 @@ static ur_result_t enqueueCommandBufferFillHelper(
std::vector WaitNodes =
NumEventsInWaitList ? std::move(DepsList) : std::vector();
- auto NewCommand = new T(CommandBuffer, GraphNode, SignalNode, WaitNodes);
+ auto NewCommand = new T(CommandBuffer, GraphNode, SignalNode, WaitNodes,
+ std::move(DecomposedNodes));
CommandBuffer->CommandHandles.push_back(NewCommand);
if (RetCommand) {
diff --git a/source/adapters/cuda/command_buffer.hpp b/source/adapters/cuda/command_buffer.hpp
index 67d725c3ad..839d3fb159 100644
--- a/source/adapters/cuda/command_buffer.hpp
+++ b/source/adapters/cuda/command_buffer.hpp
@@ -172,12 +172,19 @@ struct usm_memcpy_command_handle : ur_exp_command_buffer_command_handle_t_ {
struct usm_fill_command_handle : ur_exp_command_buffer_command_handle_t_ {
usm_fill_command_handle(ur_exp_command_buffer_handle_t CommandBuffer,
CUgraphNode Node, CUgraphNode SignalNode,
- const std::vector &WaitNodes)
+ const std::vector &WaitNodes,
+ const std::vector &DecomposedNodes = {})
: ur_exp_command_buffer_command_handle_t_(CommandBuffer, Node, SignalNode,
- WaitNodes) {}
+ WaitNodes),
+ DecomposedNodes(std::move(DecomposedNodes)) {}
CommandType getCommandType() const noexcept override {
return CommandType::USMFill;
}
+
+ // If this fill command was decomposed into multiple nodes, this vector
+ // contains all of those nodes in the order they were added to the graph.
+ // Currently unused but will be required for updating in future.
+ std::vector DecomposedNodes;
};
struct buffer_copy_command_handle : ur_exp_command_buffer_command_handle_t_ {
@@ -250,14 +257,21 @@ struct buffer_write_rect_command_handle
};
struct buffer_fill_command_handle : ur_exp_command_buffer_command_handle_t_ {
- buffer_fill_command_handle(ur_exp_command_buffer_handle_t CommandBuffer,
- CUgraphNode Node, CUgraphNode SignalNode,
- const std::vector &WaitNodes)
+ buffer_fill_command_handle(
+ ur_exp_command_buffer_handle_t CommandBuffer, CUgraphNode Node,
+ CUgraphNode SignalNode, const std::vector &WaitNodes,
+ const std::vector &DecomposedNodes = {})
: ur_exp_command_buffer_command_handle_t_(CommandBuffer, Node, SignalNode,
- WaitNodes) {}
+ WaitNodes),
+ DecomposedNodes(std::move(DecomposedNodes)) {}
CommandType getCommandType() const noexcept override {
return CommandType::MemBufferFill;
}
+
+ // If this fill command was decomposed into multiple nodes, this vector
+ // contains all of those nodes in the order they were added to the graph.
+ // Currently unused but will be required for updating in future.
+ std::vector DecomposedNodes;
};
struct usm_prefetch_command_handle : ur_exp_command_buffer_command_handle_t_ {
diff --git a/source/adapters/cuda/kernel.cpp b/source/adapters/cuda/kernel.cpp
index 46c4907d4b..340e5ff634 100644
--- a/source/adapters/cuda/kernel.cpp
+++ b/source/adapters/cuda/kernel.cpp
@@ -190,10 +190,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelGetNativeHandle(
}
UR_APIEXPORT ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
- ur_kernel_handle_t hKernel, uint32_t workDim, const size_t *pLocalWorkSize,
- size_t dynamicSharedMemorySize, uint32_t *pGroupCountRet) {
+ ur_kernel_handle_t hKernel, ur_device_handle_t hDevice, uint32_t workDim,
+ const size_t *pLocalWorkSize, size_t dynamicSharedMemorySize,
+ uint32_t *pGroupCountRet) {
UR_ASSERT(hKernel, UR_RESULT_ERROR_INVALID_KERNEL);
+ std::ignore = hDevice;
+
size_t localWorkSize = pLocalWorkSize[0];
localWorkSize *= (workDim >= 2 ? pLocalWorkSize[1] : 1);
localWorkSize *= (workDim == 3 ? pLocalWorkSize[2] : 1);
diff --git a/source/adapters/hip/kernel.cpp b/source/adapters/hip/kernel.cpp
index 1ba50c4360..a5aefb1293 100644
--- a/source/adapters/hip/kernel.cpp
+++ b/source/adapters/hip/kernel.cpp
@@ -169,9 +169,11 @@ urKernelGetNativeHandle(ur_kernel_handle_t, ur_native_handle_t *) {
}
UR_APIEXPORT ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
- ur_kernel_handle_t hKernel, uint32_t workDim, const size_t *pLocalWorkSize,
- size_t dynamicSharedMemorySize, uint32_t *pGroupCountRet) {
+ ur_kernel_handle_t hKernel, ur_device_handle_t hDevice, uint32_t workDim,
+ const size_t *pLocalWorkSize, size_t dynamicSharedMemorySize,
+ uint32_t *pGroupCountRet) {
std::ignore = hKernel;
+ std::ignore = hDevice;
std::ignore = workDim;
std::ignore = pLocalWorkSize;
std::ignore = dynamicSharedMemorySize;
diff --git a/source/adapters/level_zero/command_buffer.cpp b/source/adapters/level_zero/command_buffer.cpp
index b96aeeede9..c4d9614159 100644
--- a/source/adapters/level_zero/command_buffer.cpp
+++ b/source/adapters/level_zero/command_buffer.cpp
@@ -26,14 +26,9 @@ namespace {
// given Context and Device.
bool checkImmediateAppendSupport(ur_context_handle_t Context,
ur_device_handle_t Device) {
- // TODO The L0 driver is not reporting this extension yet. Once it does,
- // switch to using the variable zeDriverImmediateCommandListAppendFound.
- // Minimum version that supports zeCommandListImmediateAppendCommandListsExp.
- constexpr uint32_t MinDriverVersion = 30898;
bool DriverSupportsImmediateAppend =
- Context->getPlatform()->isDriverVersionNewerOrSimilar(1, 3,
- MinDriverVersion);
+ Context->getPlatform()->ZeCommandListImmediateAppendExt.Supported;
// If this environment variable is:
// - Set to 1: the immediate append path will always be enabled as long the
@@ -58,10 +53,8 @@ bool checkImmediateAppendSupport(ur_context_handle_t Context,
if (EnableAppendPath && !DriverSupportsImmediateAppend) {
logger::error("{} is set but "
"the current driver does not support the "
- "zeCommandListImmediateAppendCommandListsExp entrypoint. A "
- "driver version of at least {} is required to use the "
- "immediate append path.",
- AppendEnvVarName, MinDriverVersion);
+ "zeCommandListImmediateAppendCommandListsExp entrypoint.",
+ AppendEnvVarName);
std::abort();
}
@@ -1569,7 +1562,10 @@ ur_result_t enqueueImmediateAppendPath(
ur_event_handle_t *Event, ur_command_list_ptr_t CommandListHelper,
bool DoProfiling) {
+ ur_platform_handle_t Platform = CommandBuffer->Context->getPlatform();
+
assert(CommandListHelper->second.IsImmediate);
+ assert(Platform->ZeCommandListImmediateAppendExt.Supported);
_ur_ze_event_list_t UrZeEventList;
if (NumEventsInWaitList) {
@@ -1587,7 +1583,8 @@ ur_result_t enqueueImmediateAppendPath(
nullptr /*ForcedCmdQueue*/));
assert(ZeCopyEngineImmediateListHelper->second.IsImmediate);
- ZE2UR_CALL(zeCommandListImmediateAppendCommandListsExp,
+ ZE2UR_CALL(Platform->ZeCommandListImmediateAppendExt
+ .zeCommandListImmediateAppendCommandListsExp,
(ZeCopyEngineImmediateListHelper->first, 1,
&CommandBuffer->ZeCopyCommandList, nullptr,
UrZeEventList.Length, UrZeEventList.ZeEventList));
@@ -1599,7 +1596,8 @@ ur_result_t enqueueImmediateAppendPath(
ze_event_handle_t &EventToSignal =
DoProfiling ? CommandBuffer->ComputeFinishedEvent->ZeEvent
: (*Event)->ZeEvent;
- ZE2UR_CALL(zeCommandListImmediateAppendCommandListsExp,
+ ZE2UR_CALL(Platform->ZeCommandListImmediateAppendExt
+ .zeCommandListImmediateAppendCommandListsExp,
(CommandListHelper->first, 1, &CommandBuffer->ZeComputeCommandList,
EventToSignal, WaitList.Length, WaitList.ZeEventList));
@@ -1616,7 +1614,8 @@ ur_result_t enqueueImmediateAppendPath(
(CommandListHelper->first,
CommandBuffer->ExecutionFinishedEvent->ZeEvent, 0, nullptr));
- ZE2UR_CALL(zeCommandListImmediateAppendCommandListsExp,
+ ZE2UR_CALL(Platform->ZeCommandListImmediateAppendExt
+ .zeCommandListImmediateAppendCommandListsExp,
(CommandListHelper->first, 1,
&CommandBuffer->ZeCommandListResetEvents, nullptr, 0, nullptr));
}
diff --git a/source/adapters/level_zero/context.cpp b/source/adapters/level_zero/context.cpp
index b284dbff8e..6d90de82ca 100644
--- a/source/adapters/level_zero/context.cpp
+++ b/source/adapters/level_zero/context.cpp
@@ -422,6 +422,7 @@ ur_result_t ur_context_handle_t_::finalize() {
for (auto &EventCache : EventCaches) {
for (auto &Event : EventCache) {
auto ZeResult = ZE_CALL_NOCHECK(zeEventDestroy, (Event->ZeEvent));
+ Event->ZeEvent = nullptr;
// Gracefully handle the case that L0 was already unloaded.
if (ZeResult && ZeResult != ZE_RESULT_ERROR_UNINITIALIZED)
return ze2urResult(ZeResult);
diff --git a/source/adapters/level_zero/event.cpp b/source/adapters/level_zero/event.cpp
index 7993ceafed..4ae067adc7 100644
--- a/source/adapters/level_zero/event.cpp
+++ b/source/adapters/level_zero/event.cpp
@@ -1051,6 +1051,26 @@ ur_result_t ur_event_handle_t_::getOrCreateHostVisibleEvent(
return UR_RESULT_SUCCESS;
}
+/**
+ * @brief Destructor for the ur_event_handle_t_ class.
+ *
+ * This destructor is responsible for cleaning up the event handle when the
+ * object is destroyed. It checks if the event (`ZeEvent`) is valid and if the
+ * event has been completed (`Completed`). If both conditions are met, it
+ * further checks if the associated queue (`UrQueue`) is valid and if it is not
+ * set to discard events. If all conditions are satisfied, it calls
+ * `zeEventDestroy` to destroy the event.
+ *
+ * This ensures that resources are properly released and avoids potential memory
+ * leaks or resource mismanagement.
+ */
+ur_event_handle_t_::~ur_event_handle_t_() {
+ if (this->ZeEvent && this->Completed) {
+ if (this->UrQueue && !this->UrQueue->isDiscardEvents())
+ ZE_CALL_NOCHECK(zeEventDestroy, (this->ZeEvent));
+ }
+}
+
ur_result_t urEventReleaseInternal(ur_event_handle_t Event) {
if (!Event->RefCount.decrementAndTest())
return UR_RESULT_SUCCESS;
@@ -1073,6 +1093,7 @@ ur_result_t urEventReleaseInternal(ur_event_handle_t Event) {
if (Event->OwnNativeHandle) {
if (DisableEventsCaching) {
auto ZeResult = ZE_CALL_NOCHECK(zeEventDestroy, (Event->ZeEvent));
+ Event->ZeEvent = nullptr;
// Gracefully handle the case that L0 was already unloaded.
if (ZeResult && ZeResult != ZE_RESULT_ERROR_UNINITIALIZED)
return ze2urResult(ZeResult);
diff --git a/source/adapters/level_zero/event.hpp b/source/adapters/level_zero/event.hpp
index 6d02991f79..3c1e61d87e 100644
--- a/source/adapters/level_zero/event.hpp
+++ b/source/adapters/level_zero/event.hpp
@@ -158,6 +158,8 @@ struct ur_event_handle_t_ : _ur_object {
reinterpret_cast(HostVisibleEvent));
}
+ ~ur_event_handle_t_();
+
// Provide direct access to Context, instead of going via queue.
// Not every PI event has a queue, and we need a handle to Context
// to get to event pool related information.
diff --git a/source/adapters/level_zero/kernel.cpp b/source/adapters/level_zero/kernel.cpp
index b15b4ce147..db9337289f 100644
--- a/source/adapters/level_zero/kernel.cpp
+++ b/source/adapters/level_zero/kernel.cpp
@@ -1054,8 +1054,9 @@ ur_result_t urKernelGetNativeHandle(
}
ur_result_t urKernelSuggestMaxCooperativeGroupCountExp(
- ur_kernel_handle_t hKernel, uint32_t workDim, const size_t *pLocalWorkSize,
- size_t dynamicSharedMemorySize, uint32_t *pGroupCountRet) {
+ ur_kernel_handle_t hKernel, ur_device_handle_t hDevice, uint32_t workDim,
+ const size_t *pLocalWorkSize, size_t dynamicSharedMemorySize,
+ uint32_t *pGroupCountRet) {
(void)dynamicSharedMemorySize;
std::shared_lock Guard(hKernel->Mutex);
@@ -1066,8 +1067,10 @@ ur_result_t urKernelSuggestMaxCooperativeGroupCountExp(
ZE2UR_CALL(zeKernelSetGroupSize, (hKernel->ZeKernel, WG[0], WG[1], WG[2]));
uint32_t TotalGroupCount = 0;
+ ze_kernel_handle_t ZeKernel;
+ UR_CALL(getZeKernel(hDevice->ZeDevice, hKernel, &ZeKernel));
ZE2UR_CALL(zeKernelSuggestMaxCooperativeGroupCount,
- (hKernel->ZeKernel, &TotalGroupCount));
+ (ZeKernel, &TotalGroupCount));
*pGroupCountRet = TotalGroupCount;
return UR_RESULT_SUCCESS;
}
diff --git a/source/adapters/level_zero/platform.cpp b/source/adapters/level_zero/platform.cpp
index 6ae1deaabc..26b5a03ed6 100644
--- a/source/adapters/level_zero/platform.cpp
+++ b/source/adapters/level_zero/platform.cpp
@@ -224,6 +224,7 @@ ur_result_t ur_platform_handle_t_::initialize() {
bool MutableCommandListSpecExtensionSupported = false;
bool ZeIntelExternalSemaphoreExtensionSupported = false;
+ bool ZeImmediateCommandListAppendExtensionFound = false;
for (auto &extension : ZeExtensions) {
// Check if global offset extension is available
if (strncmp(extension.name, ZE_GLOBAL_OFFSET_EXP_NAME,
@@ -248,6 +249,14 @@ ur_result_t ur_platform_handle_t_::initialize() {
ZeDriverEventPoolCountingEventsExtensionFound = true;
}
}
+ // Check if the ImmediateAppendCommandLists extension is available.
+ if (strncmp(extension.name, ZE_IMMEDIATE_COMMAND_LIST_APPEND_EXP_NAME,
+ strlen(ZE_IMMEDIATE_COMMAND_LIST_APPEND_EXP_NAME) + 1) == 0) {
+ if (extension.version ==
+ ZE_IMMEDIATE_COMMAND_LIST_APPEND_EXP_VERSION_CURRENT) {
+ ZeImmediateCommandListAppendExtensionFound = true;
+ }
+ }
// Check if extension is available for Mutable Command List v1.1.
if (strncmp(extension.name, ZE_MUTABLE_COMMAND_LIST_EXP_NAME,
strlen(ZE_MUTABLE_COMMAND_LIST_EXP_NAME) + 1) == 0) {
@@ -427,6 +436,21 @@ ur_result_t ur_platform_handle_t_::initialize() {
&ZeMutableCmdListExt
.zexCommandListGetNextCommandIdWithKernelsExp))) == 0);
}
+
+ // Check if ImmediateAppendCommandList is supported and initialize the
+ // function pointer.
+ if (ZeImmediateCommandListAppendExtensionFound) {
+ ZeCommandListImmediateAppendExt
+ .zeCommandListImmediateAppendCommandListsExp =
+ (ze_pfnCommandListImmediateAppendCommandListsExp_t)
+ ur_loader::LibLoader::getFunctionPtr(
+ GlobalAdapter->processHandle,
+ "zeCommandListImmediateAppendCommandListsExp");
+ ZeCommandListImmediateAppendExt.Supported =
+ ZeCommandListImmediateAppendExt
+ .zeCommandListImmediateAppendCommandListsExp != nullptr;
+ }
+
return UR_RESULT_SUCCESS;
}
diff --git a/source/adapters/level_zero/platform.hpp b/source/adapters/level_zero/platform.hpp
index 748460158c..0faa122651 100644
--- a/source/adapters/level_zero/platform.hpp
+++ b/source/adapters/level_zero/platform.hpp
@@ -134,4 +134,11 @@ struct ur_platform_handle_t_ : public _ur_platform {
ze_result_t (*zexDeviceReleaseExternalSemaphoreExp)(
ze_intel_external_semaphore_exp_handle_t);
} ZeExternalSemaphoreExt;
-};
\ No newline at end of file
+
+ struct ZeCommandListImmediateAppendExtension {
+ bool Supported = false;
+ ze_result_t (*zeCommandListImmediateAppendCommandListsExp)(
+ ze_command_list_handle_t, uint32_t, ze_command_list_handle_t *,
+ ze_event_handle_t, uint32_t, ze_event_handle_t *);
+ } ZeCommandListImmediateAppendExt;
+};
diff --git a/source/adapters/level_zero/ur_interface_loader.hpp b/source/adapters/level_zero/ur_interface_loader.hpp
index 5bd7c904f1..f2fd6a46d4 100644
--- a/source/adapters/level_zero/ur_interface_loader.hpp
+++ b/source/adapters/level_zero/ur_interface_loader.hpp
@@ -691,8 +691,9 @@ ur_result_t urEnqueueCooperativeKernelLaunchExp(
const size_t *pLocalWorkSize, uint32_t numEventsInWaitList,
const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent);
ur_result_t urKernelSuggestMaxCooperativeGroupCountExp(
- ur_kernel_handle_t hKernel, uint32_t workDim, const size_t *pLocalWorkSize,
- size_t dynamicSharedMemorySize, uint32_t *pGroupCountRet);
+ ur_kernel_handle_t hKernel, ur_device_handle_t hDevice, uint32_t workDim,
+ const size_t *pLocalWorkSize, size_t dynamicSharedMemorySize,
+ uint32_t *pGroupCountRet);
ur_result_t urEnqueueTimestampRecordingExp(
ur_queue_handle_t hQueue, bool blocking, uint32_t numEventsInWaitList,
const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent);
diff --git a/source/adapters/level_zero/v2/api.cpp b/source/adapters/level_zero/v2/api.cpp
index f774f9e263..6142c3d8a4 100644
--- a/source/adapters/level_zero/v2/api.cpp
+++ b/source/adapters/level_zero/v2/api.cpp
@@ -485,8 +485,9 @@ ur_result_t urCommandBufferCommandGetInfoExp(
}
ur_result_t urKernelSuggestMaxCooperativeGroupCountExp(
- ur_kernel_handle_t hKernel, uint32_t workDim, const size_t *pLocalWorkSize,
- size_t dynamicSharedMemorySize, uint32_t *pGroupCountRet) {
+ ur_kernel_handle_t hKernel, ur_device_handle_t hDevice, uint32_t workDim,
+ const size_t *pLocalWorkSize, size_t dynamicSharedMemorySize,
+ uint32_t *pGroupCountRet) {
logger::error("{} function not implemented!", __FUNCTION__);
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
diff --git a/source/adapters/mock/ur_mockddi.cpp b/source/adapters/mock/ur_mockddi.cpp
index b60be1d561..b27c4efaa1 100644
--- a/source/adapters/mock/ur_mockddi.cpp
+++ b/source/adapters/mock/ur_mockddi.cpp
@@ -10057,6 +10057,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp(
/// @brief Intercept function for urKernelSuggestMaxCooperativeGroupCountExp
__urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object
+ ur_device_handle_t hDevice, ///< [in] handle of the device object
uint32_t
workDim, ///< [in] number of dimensions, from 1 to 3, to specify the work-group
///< work-items
@@ -10072,7 +10073,11 @@ __urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
ur_result_t result = UR_RESULT_SUCCESS;
ur_kernel_suggest_max_cooperative_group_count_exp_params_t params = {
- &hKernel, &workDim, &pLocalWorkSize, &dynamicSharedMemorySize,
+ &hKernel,
+ &hDevice,
+ &workDim,
+ &pLocalWorkSize,
+ &dynamicSharedMemorySize,
&pGroupCountRet};
auto beforeCallback = reinterpret_cast(
diff --git a/source/adapters/native_cpu/device.cpp b/source/adapters/native_cpu/device.cpp
index 48cdf9a404..b00892d040 100644
--- a/source/adapters/native_cpu/device.cpp
+++ b/source/adapters/native_cpu/device.cpp
@@ -420,6 +420,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
case UR_DEVICE_INFO_ENQUEUE_NATIVE_COMMAND_SUPPORT_EXP:
return ReturnValue(false);
+ case UR_DEVICE_INFO_HOST_PIPE_READ_WRITE_SUPPORTED:
+ return ReturnValue(ur_bool_t{false});
+
case UR_DEVICE_INFO_USM_POOL_SUPPORT:
return ReturnValue(false);
diff --git a/source/adapters/opencl/kernel.cpp b/source/adapters/opencl/kernel.cpp
index df160b65eb..fb2c735adc 100644
--- a/source/adapters/opencl/kernel.cpp
+++ b/source/adapters/opencl/kernel.cpp
@@ -390,6 +390,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelGetNativeHandle(
UR_APIEXPORT ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
[[maybe_unused]] ur_kernel_handle_t hKernel,
+ [[maybe_unused]] ur_device_handle_t hDevice,
[[maybe_unused]] uint32_t workDim,
[[maybe_unused]] const size_t *pLocalWorkSize,
[[maybe_unused]] size_t dynamicSharedMemorySize,
diff --git a/source/loader/layers/tracing/ur_trcddi.cpp b/source/loader/layers/tracing/ur_trcddi.cpp
index 55f8d00bea..3e8043a258 100644
--- a/source/loader/layers/tracing/ur_trcddi.cpp
+++ b/source/loader/layers/tracing/ur_trcddi.cpp
@@ -8633,6 +8633,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp(
/// @brief Intercept function for urKernelSuggestMaxCooperativeGroupCountExp
__urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object
+ ur_device_handle_t hDevice, ///< [in] handle of the device object
uint32_t
workDim, ///< [in] number of dimensions, from 1 to 3, to specify the work-group
///< work-items
@@ -8654,7 +8655,11 @@ __urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
}
ur_kernel_suggest_max_cooperative_group_count_exp_params_t params = {
- &hKernel, &workDim, &pLocalWorkSize, &dynamicSharedMemorySize,
+ &hKernel,
+ &hDevice,
+ &workDim,
+ &pLocalWorkSize,
+ &dynamicSharedMemorySize,
&pGroupCountRet};
uint64_t instance = getContext()->notify_begin(
UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP,
@@ -8664,7 +8669,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
logger.info(" ---> urKernelSuggestMaxCooperativeGroupCountExp\n");
ur_result_t result = pfnSuggestMaxCooperativeGroupCountExp(
- hKernel, workDim, pLocalWorkSize, dynamicSharedMemorySize,
+ hKernel, hDevice, workDim, pLocalWorkSize, dynamicSharedMemorySize,
pGroupCountRet);
getContext()->notify_end(
diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp
index 519fe9248e..f64f61e11d 100644
--- a/source/loader/layers/validation/ur_valddi.cpp
+++ b/source/loader/layers/validation/ur_valddi.cpp
@@ -9656,6 +9656,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp(
/// @brief Intercept function for urKernelSuggestMaxCooperativeGroupCountExp
__urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object
+ ur_device_handle_t hDevice, ///< [in] handle of the device object
uint32_t
workDim, ///< [in] number of dimensions, from 1 to 3, to specify the work-group
///< work-items
@@ -9681,6 +9682,10 @@ __urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
return UR_RESULT_ERROR_INVALID_NULL_HANDLE;
}
+ if (NULL == hDevice) {
+ return UR_RESULT_ERROR_INVALID_NULL_HANDLE;
+ }
+
if (NULL == pLocalWorkSize) {
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
}
@@ -9695,8 +9700,13 @@ __urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
getContext()->refCountContext->logInvalidReference(hKernel);
}
+ if (getContext()->enableLifetimeValidation &&
+ !getContext()->refCountContext->isReferenceValid(hDevice)) {
+ getContext()->refCountContext->logInvalidReference(hDevice);
+ }
+
ur_result_t result = pfnSuggestMaxCooperativeGroupCountExp(
- hKernel, workDim, pLocalWorkSize, dynamicSharedMemorySize,
+ hKernel, hDevice, workDim, pLocalWorkSize, dynamicSharedMemorySize,
pGroupCountRet);
return result;
diff --git a/source/loader/ur_ldrddi.cpp b/source/loader/ur_ldrddi.cpp
index 27331c33c4..7696489d97 100644
--- a/source/loader/ur_ldrddi.cpp
+++ b/source/loader/ur_ldrddi.cpp
@@ -8877,6 +8877,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp(
/// @brief Intercept function for urKernelSuggestMaxCooperativeGroupCountExp
__urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object
+ ur_device_handle_t hDevice, ///< [in] handle of the device object
uint32_t
workDim, ///< [in] number of dimensions, from 1 to 3, to specify the work-group
///< work-items
@@ -8904,9 +8905,12 @@ __urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
// convert loader handle to platform handle
hKernel = reinterpret_cast(hKernel)->handle;
+ // convert loader handle to platform handle
+ hDevice = reinterpret_cast(hDevice)->handle;
+
// forward to device-platform
result = pfnSuggestMaxCooperativeGroupCountExp(
- hKernel, workDim, pLocalWorkSize, dynamicSharedMemorySize,
+ hKernel, hDevice, workDim, pLocalWorkSize, dynamicSharedMemorySize,
pGroupCountRet);
return result;
diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp
index bfb51783a5..b8425367cf 100644
--- a/source/loader/ur_libapi.cpp
+++ b/source/loader/ur_libapi.cpp
@@ -8935,12 +8935,14 @@ ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp(
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `NULL == hKernel`
+/// + `NULL == hDevice`
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
/// + `NULL == pLocalWorkSize`
/// + `NULL == pGroupCountRet`
/// - ::UR_RESULT_ERROR_INVALID_KERNEL
ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object
+ ur_device_handle_t hDevice, ///< [in] handle of the device object
uint32_t
workDim, ///< [in] number of dimensions, from 1 to 3, to specify the work-group
///< work-items
@@ -8961,7 +8963,7 @@ ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
}
return pfnSuggestMaxCooperativeGroupCountExp(
- hKernel, workDim, pLocalWorkSize, dynamicSharedMemorySize,
+ hKernel, hDevice, workDim, pLocalWorkSize, dynamicSharedMemorySize,
pGroupCountRet);
} catch (...) {
return exceptionToResult(std::current_exception());
diff --git a/source/ur_api.cpp b/source/ur_api.cpp
index 0e88a12052..745f018aef 100644
--- a/source/ur_api.cpp
+++ b/source/ur_api.cpp
@@ -7578,12 +7578,14 @@ ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp(
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `NULL == hKernel`
+/// + `NULL == hDevice`
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
/// + `NULL == pLocalWorkSize`
/// + `NULL == pGroupCountRet`
/// - ::UR_RESULT_ERROR_INVALID_KERNEL
ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object
+ ur_device_handle_t hDevice, ///< [in] handle of the device object
uint32_t
workDim, ///< [in] number of dimensions, from 1 to 3, to specify the work-group
///< work-items
diff --git a/test/adapters/cuda/urDeviceCreateWithNativeHandle.cpp b/test/adapters/cuda/urDeviceCreateWithNativeHandle.cpp
index e4ac022507..615e6e95dd 100644
--- a/test/adapters/cuda/urDeviceCreateWithNativeHandle.cpp
+++ b/test/adapters/cuda/urDeviceCreateWithNativeHandle.cpp
@@ -5,7 +5,7 @@
#include "fixtures.h"
-using urCudaDeviceCreateWithNativeHandle = uur::urPlatformTest;
+using urCudaDeviceCreateWithNativeHandle = uur::urSelectedPlatformTest;
TEST_F(urCudaDeviceCreateWithNativeHandle, Success) {
// get a device from cuda
diff --git a/test/adapters/level_zero/ze_tracer_common.hpp b/test/adapters/level_zero/ze_tracer_common.hpp
index ed33eb30a5..9d25a5f452 100644
--- a/test/adapters/level_zero/ze_tracer_common.hpp
+++ b/test/adapters/level_zero/ze_tracer_common.hpp
@@ -5,7 +5,7 @@
#include "uur/fixtures.h"
-#include
+#include
#include
#include
diff --git a/test/conformance/device/device_adapter_native_cpu.match b/test/conformance/device/device_adapter_native_cpu.match
index da07da18dc..2764ad4fd1 100644
--- a/test/conformance/device/device_adapter_native_cpu.match
+++ b/test/conformance/device/device_adapter_native_cpu.match
@@ -11,7 +11,6 @@ urDeviceGetInfoTest.Success/UR_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRES
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_MAX_WORK_GROUPS_3D
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_ASYNC_BARRIER
-urDeviceGetInfoTest.Success/UR_DEVICE_INFO_HOST_PIPE_READ_WRITE_SUPPORTED
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_KERNEL_SET_SPECIALIZATION_CONSTANTS
diff --git a/test/conformance/device/urDeviceGet.cpp b/test/conformance/device/urDeviceGet.cpp
index 5ce4c45906..f6ec9d82aa 100644
--- a/test/conformance/device/urDeviceGet.cpp
+++ b/test/conformance/device/urDeviceGet.cpp
@@ -6,8 +6,9 @@
#include
using urDeviceGetTest = uur::urPlatformTest;
+UUR_INSTANTIATE_PLATFORM_TEST_SUITE_P(urDeviceGetTest);
-TEST_F(urDeviceGetTest, Success) {
+TEST_P(urDeviceGetTest, Success) {
uint32_t count = 0;
ASSERT_SUCCESS(
urDeviceGet(platform, UR_DEVICE_TYPE_ALL, 0, nullptr, &count));
@@ -20,7 +21,7 @@ TEST_F(urDeviceGetTest, Success) {
}
}
-TEST_F(urDeviceGetTest, SuccessSubsetOfDevices) {
+TEST_P(urDeviceGetTest, SuccessSubsetOfDevices) {
uint32_t count;
ASSERT_SUCCESS(
urDeviceGet(platform, UR_DEVICE_TYPE_ALL, 0, nullptr, &count));
@@ -35,6 +36,41 @@ TEST_F(urDeviceGetTest, SuccessSubsetOfDevices) {
}
}
+TEST_P(urDeviceGetTest, InvalidNullHandlePlatform) {
+ uint32_t count;
+ ASSERT_EQ_RESULT(
+ UR_RESULT_ERROR_INVALID_NULL_HANDLE,
+ urDeviceGet(nullptr, UR_DEVICE_TYPE_ALL, 0, nullptr, &count));
+}
+
+TEST_P(urDeviceGetTest, InvalidEnumerationDevicesType) {
+ uint32_t count;
+ ASSERT_EQ_RESULT(
+ UR_RESULT_ERROR_INVALID_ENUMERATION,
+ urDeviceGet(platform, UR_DEVICE_TYPE_FORCE_UINT32, 0, nullptr, &count));
+}
+
+TEST_P(urDeviceGetTest, InvalidSizeNumEntries) {
+ uint32_t count = 0;
+ ASSERT_SUCCESS(
+ urDeviceGet(platform, UR_DEVICE_TYPE_ALL, 0, nullptr, &count));
+ ASSERT_NE(count, 0);
+ std::vector devices(count);
+ ASSERT_EQ_RESULT(
+ UR_RESULT_ERROR_INVALID_SIZE,
+ urDeviceGet(platform, UR_DEVICE_TYPE_ALL, 0, devices.data(), nullptr));
+}
+
+TEST_P(urDeviceGetTest, InvalidNullPointerDevices) {
+ uint32_t count = 0;
+ ASSERT_SUCCESS(
+ urDeviceGet(platform, UR_DEVICE_TYPE_ALL, 0, nullptr, &count));
+ ASSERT_NE(count, 0);
+ ASSERT_EQ_RESULT(
+ UR_RESULT_ERROR_INVALID_NULL_POINTER,
+ urDeviceGet(platform, UR_DEVICE_TYPE_ALL, count, nullptr, nullptr));
+}
+
struct urDeviceGetTestWithDeviceTypeParam
: uur::urAllDevicesTest,
::testing::WithParamInterface {
@@ -70,38 +106,3 @@ TEST_P(urDeviceGetTestWithDeviceTypeParam, Success) {
}
}
}
-
-TEST_F(urDeviceGetTest, InvalidNullHandlePlatform) {
- uint32_t count;
- ASSERT_EQ_RESULT(
- UR_RESULT_ERROR_INVALID_NULL_HANDLE,
- urDeviceGet(nullptr, UR_DEVICE_TYPE_ALL, 0, nullptr, &count));
-}
-
-TEST_F(urDeviceGetTest, InvalidEnumerationDevicesType) {
- uint32_t count;
- ASSERT_EQ_RESULT(
- UR_RESULT_ERROR_INVALID_ENUMERATION,
- urDeviceGet(platform, UR_DEVICE_TYPE_FORCE_UINT32, 0, nullptr, &count));
-}
-
-TEST_F(urDeviceGetTest, InvalidSizeNumEntries) {
- uint32_t count = 0;
- ASSERT_SUCCESS(
- urDeviceGet(platform, UR_DEVICE_TYPE_ALL, 0, nullptr, &count));
- ASSERT_NE(count, 0);
- std::vector devices(count);
- ASSERT_EQ_RESULT(
- UR_RESULT_ERROR_INVALID_SIZE,
- urDeviceGet(platform, UR_DEVICE_TYPE_ALL, 0, devices.data(), nullptr));
-}
-
-TEST_F(urDeviceGetTest, InvalidNullPointerDevices) {
- uint32_t count = 0;
- ASSERT_SUCCESS(
- urDeviceGet(platform, UR_DEVICE_TYPE_ALL, 0, nullptr, &count));
- ASSERT_NE(count, 0);
- ASSERT_EQ_RESULT(
- UR_RESULT_ERROR_INVALID_NULL_POINTER,
- urDeviceGet(platform, UR_DEVICE_TYPE_ALL, count, nullptr, nullptr));
-}
diff --git a/test/conformance/device/urDeviceGetSelected.cpp b/test/conformance/device/urDeviceGetSelected.cpp
index 953b418e24..2099d226c4 100644
--- a/test/conformance/device/urDeviceGetSelected.cpp
+++ b/test/conformance/device/urDeviceGetSelected.cpp
@@ -7,10 +7,11 @@
#include
using urDeviceGetSelectedTest = uur::urPlatformTest;
+UUR_INSTANTIATE_PLATFORM_TEST_SUITE_P(urDeviceGetSelectedTest);
/* adpater agnostic tests -- none assume the existence or support of any specific adapter */
-TEST_F(urDeviceGetSelectedTest, Success) {
+TEST_P(urDeviceGetSelectedTest, Success) {
unsetenv("ONEAPI_DEVICE_SELECTOR");
uint32_t count = 0;
ASSERT_SUCCESS(
@@ -24,7 +25,7 @@ TEST_F(urDeviceGetSelectedTest, Success) {
}
}
-TEST_F(urDeviceGetSelectedTest, SuccessSubsetOfDevices) {
+TEST_P(urDeviceGetSelectedTest, SuccessSubsetOfDevices) {
unsetenv("ONEAPI_DEVICE_SELECTOR");
uint32_t count = 0;
ASSERT_SUCCESS(
@@ -41,7 +42,7 @@ TEST_F(urDeviceGetSelectedTest, SuccessSubsetOfDevices) {
}
}
-TEST_F(urDeviceGetSelectedTest, SuccessSelected_StarColonStar) {
+TEST_P(urDeviceGetSelectedTest, SuccessSelected_StarColonStar) {
setenv("ONEAPI_DEVICE_SELECTOR", "*:*", 1);
uint32_t count = 0;
ASSERT_SUCCESS(
@@ -71,7 +72,7 @@ TEST_F(urDeviceGetSelectedTest, SuccessSelected_StarColonStar) {
}
}
-TEST_F(urDeviceGetSelectedTest, SuccessSelected_StarColonZero) {
+TEST_P(urDeviceGetSelectedTest, SuccessSelected_StarColonZero) {
setenv("ONEAPI_DEVICE_SELECTOR", "*:0", 1);
uint32_t count = 0;
ASSERT_SUCCESS(
@@ -85,7 +86,7 @@ TEST_F(urDeviceGetSelectedTest, SuccessSelected_StarColonZero) {
}
}
-TEST_F(urDeviceGetSelectedTest, SuccessSelected_StarColonZeroCommaStar) {
+TEST_P(urDeviceGetSelectedTest, SuccessSelected_StarColonZeroCommaStar) {
setenv("ONEAPI_DEVICE_SELECTOR", "*:0,*", 1);
uint32_t count = 0;
ASSERT_SUCCESS(
@@ -99,7 +100,7 @@ TEST_F(urDeviceGetSelectedTest, SuccessSelected_StarColonZeroCommaStar) {
}
}
-TEST_F(urDeviceGetSelectedTest, SuccessSelected_DiscardStarColonStar) {
+TEST_P(urDeviceGetSelectedTest, SuccessSelected_DiscardStarColonStar) {
setenv("ONEAPI_DEVICE_SELECTOR", "!*:*", 1);
uint32_t count = 0;
ASSERT_SUCCESS(
@@ -107,7 +108,7 @@ TEST_F(urDeviceGetSelectedTest, SuccessSelected_DiscardStarColonStar) {
ASSERT_EQ(count, 0);
}
-TEST_F(urDeviceGetSelectedTest, SuccessSelected_SelectAndDiscard) {
+TEST_P(urDeviceGetSelectedTest, SuccessSelected_SelectAndDiscard) {
setenv("ONEAPI_DEVICE_SELECTOR", "*:0;!*:*", 1);
uint32_t count = 0;
ASSERT_SUCCESS(
@@ -115,7 +116,7 @@ TEST_F(urDeviceGetSelectedTest, SuccessSelected_SelectAndDiscard) {
ASSERT_EQ(count, 0);
}
-TEST_F(urDeviceGetSelectedTest,
+TEST_P(urDeviceGetSelectedTest,
SuccessSelected_SelectSomethingAndDiscardSomethingElse) {
setenv("ONEAPI_DEVICE_SELECTOR", "*:0;!*:1", 1);
uint32_t count = 0;
@@ -130,7 +131,7 @@ TEST_F(urDeviceGetSelectedTest,
}
}
-TEST_F(urDeviceGetSelectedTest, InvalidNullHandlePlatform) {
+TEST_P(urDeviceGetSelectedTest, InvalidNullHandlePlatform) {
unsetenv("ONEAPI_DEVICE_SELECTOR");
uint32_t count = 0;
ASSERT_EQ_RESULT(
@@ -138,7 +139,7 @@ TEST_F(urDeviceGetSelectedTest, InvalidNullHandlePlatform) {
urDeviceGetSelected(nullptr, UR_DEVICE_TYPE_ALL, 0, nullptr, &count));
}
-TEST_F(urDeviceGetSelectedTest, InvalidEnumerationDevicesType) {
+TEST_P(urDeviceGetSelectedTest, InvalidEnumerationDevicesType) {
unsetenv("ONEAPI_DEVICE_SELECTOR");
uint32_t count = 0;
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_ENUMERATION,
@@ -146,7 +147,7 @@ TEST_F(urDeviceGetSelectedTest, InvalidEnumerationDevicesType) {
0, nullptr, &count));
}
-TEST_F(urDeviceGetSelectedTest, InvalidValueNumEntries) {
+TEST_P(urDeviceGetSelectedTest, InvalidValueNumEntries) {
unsetenv("ONEAPI_DEVICE_SELECTOR");
uint32_t count = 0;
ASSERT_SUCCESS(
@@ -158,7 +159,7 @@ TEST_F(urDeviceGetSelectedTest, InvalidValueNumEntries) {
devices.data(), nullptr));
}
-TEST_F(urDeviceGetSelectedTest, InvalidMissingBackend) {
+TEST_P(urDeviceGetSelectedTest, InvalidMissingBackend) {
setenv("ONEAPI_DEVICE_SELECTOR", ":garbage", 1);
uint32_t count = 0;
ASSERT_EQ_RESULT(
@@ -167,7 +168,7 @@ TEST_F(urDeviceGetSelectedTest, InvalidMissingBackend) {
ASSERT_EQ(count, 0);
}
-TEST_F(urDeviceGetSelectedTest, InvalidGarbageBackendString) {
+TEST_P(urDeviceGetSelectedTest, InvalidGarbageBackendString) {
setenv("ONEAPI_DEVICE_SELECTOR", "garbage:0", 1);
uint32_t count = 0;
ASSERT_EQ_RESULT(
@@ -176,7 +177,7 @@ TEST_F(urDeviceGetSelectedTest, InvalidGarbageBackendString) {
ASSERT_EQ(count, 0);
}
-TEST_F(urDeviceGetSelectedTest, InvalidMissingFilterStrings) {
+TEST_P(urDeviceGetSelectedTest, InvalidMissingFilterStrings) {
setenv("ONEAPI_DEVICE_SELECTOR", "*", 1);
uint32_t count = 0;
ASSERT_EQ_RESULT(
@@ -191,7 +192,7 @@ TEST_F(urDeviceGetSelectedTest, InvalidMissingFilterStrings) {
ASSERT_EQ(count2, 0);
}
-TEST_F(urDeviceGetSelectedTest, InvalidMissingFilterString) {
+TEST_P(urDeviceGetSelectedTest, InvalidMissingFilterString) {
setenv("ONEAPI_DEVICE_SELECTOR", "*:0,,2", 1);
uint32_t count = 0;
ASSERT_EQ_RESULT(
@@ -200,7 +201,7 @@ TEST_F(urDeviceGetSelectedTest, InvalidMissingFilterString) {
ASSERT_EQ(count, 0);
}
-TEST_F(urDeviceGetSelectedTest, InvalidTooManyDotsInFilterString) {
+TEST_P(urDeviceGetSelectedTest, InvalidTooManyDotsInFilterString) {
setenv("ONEAPI_DEVICE_SELECTOR", "*:0.1.2.3", 1);
uint32_t count = 0;
ASSERT_EQ_RESULT(
@@ -209,7 +210,7 @@ TEST_F(urDeviceGetSelectedTest, InvalidTooManyDotsInFilterString) {
ASSERT_EQ(count, 0);
}
-TEST_F(urDeviceGetSelectedTest, InvalidBadWildardInFilterString) {
+TEST_P(urDeviceGetSelectedTest, InvalidBadWildardInFilterString) {
setenv("ONEAPI_DEVICE_SELECTOR", "*:*.", 1);
uint32_t count = 0;
ASSERT_EQ_RESULT(
@@ -224,7 +225,7 @@ TEST_F(urDeviceGetSelectedTest, InvalidBadWildardInFilterString) {
ASSERT_EQ(count2, 0);
}
-TEST_F(urDeviceGetSelectedTest, InvalidSelectingNonexistentDevice) {
+TEST_P(urDeviceGetSelectedTest, InvalidSelectingNonexistentDevice) {
setenv("ONEAPI_DEVICE_SELECTOR", "*:4321", 1);
uint32_t count = 0;
ASSERT_SUCCESS(
@@ -232,7 +233,7 @@ TEST_F(urDeviceGetSelectedTest, InvalidSelectingNonexistentDevice) {
ASSERT_EQ(count, 0);
}
-TEST_F(urDeviceGetSelectedTest, InvalidSelectingNonexistentSubDevice) {
+TEST_P(urDeviceGetSelectedTest, InvalidSelectingNonexistentSubDevice) {
setenv("ONEAPI_DEVICE_SELECTOR", "*:0.4321", 1);
uint32_t count = 0;
ASSERT_SUCCESS(
@@ -240,7 +241,7 @@ TEST_F(urDeviceGetSelectedTest, InvalidSelectingNonexistentSubDevice) {
ASSERT_EQ(count, 0);
}
-TEST_F(urDeviceGetSelectedTest, InvalidSelectingNonexistentSubSubDevice) {
+TEST_P(urDeviceGetSelectedTest, InvalidSelectingNonexistentSubSubDevice) {
setenv("ONEAPI_DEVICE_SELECTOR", "*:0.0.4321", 1);
uint32_t count = 0;
ASSERT_SUCCESS(
diff --git a/test/conformance/enqueue/enqueue_adapter_level_zero.match b/test/conformance/enqueue/enqueue_adapter_level_zero.match
index fdfbe01690..286cafc7fa 100644
--- a/test/conformance/enqueue/enqueue_adapter_level_zero.match
+++ b/test/conformance/enqueue/enqueue_adapter_level_zero.match
@@ -54,7 +54,6 @@
{{OPT}}urEnqueueMemImageWriteTest.InvalidRegion3D/*
{{OPT}}urEnqueueKernelLaunchMultiDeviceTest.KernelLaunchReadDifferentQueues/*
urEnqueueUSMAdviseTest.InvalidSizeTooLarge/*
-urEnqueueUSMFill2DNegativeTest.OutOfBounds/*
{{OPT}}urEnqueueUSMMemcpyTest.Blocking/*
{{OPT}}urEnqueueUSMMemcpyTest.BlockingWithEvent/*
{{OPT}}urEnqueueUSMMemcpyTest.WaitForDependencies/*
diff --git a/test/conformance/enqueue/enqueue_adapter_level_zero_v2.match b/test/conformance/enqueue/enqueue_adapter_level_zero_v2.match
index f0af10a448..58a6ec4116 100644
--- a/test/conformance/enqueue/enqueue_adapter_level_zero_v2.match
+++ b/test/conformance/enqueue/enqueue_adapter_level_zero_v2.match
@@ -68,7 +68,6 @@ urEnqueueKernelLaunchKernelWgSizeTest.Success/*
{{OPT}}urEnqueueMemImageWriteTest.InvalidRegion2D/*
{{OPT}}urEnqueueMemImageWriteTest.InvalidRegion3D/*
{{OPT}}urEnqueueKernelLaunchMultiDeviceTest.KernelLaunchReadDifferentQueues/*
-urEnqueueUSMFill2DNegativeTest.OutOfBounds/*
urEnqueueUSMAdviseTest.InvalidSizeTooLarge/*
urEnqueueUSMPrefetchTest.InvalidSizeTooLarge/*
{{OPT}}urEnqueueTimestampRecordingExpTest.SuccessBlocking/*
diff --git a/test/conformance/enqueue/enqueue_adapter_native_cpu.match b/test/conformance/enqueue/enqueue_adapter_native_cpu.match
index 18abf6abfe..35b9df84de 100644
--- a/test/conformance/enqueue/enqueue_adapter_native_cpu.match
+++ b/test/conformance/enqueue/enqueue_adapter_native_cpu.match
@@ -139,16 +139,6 @@ urEnqueueEventsWaitWithBarrierOrderingTest.SuccessNonEventDependencies/*_
{{OPT}}urEnqueueUSMPrefetchTest.InvalidSizeZero/*
{{OPT}}urEnqueueUSMPrefetchTest.InvalidSizeTooLarge/*
{{OPT}}urEnqueueUSMPrefetchTest.InvalidEventWaitList/*
-{{OPT}}urEnqueueReadHostPipeTest.InvalidNullHandleQueue/*
-{{OPT}}urEnqueueReadHostPipeTest.InvalidNullHandleProgram/*
-{{OPT}}urEnqueueReadHostPipeTest.InvalidNullPointerPipeSymbol/*
-{{OPT}}urEnqueueReadHostPipeTest.InvalidNullPointerBuffer/*
-{{OPT}}urEnqueueReadHostPipeTest.InvalidEventWaitList/*
-{{OPT}}urEnqueueWriteHostPipeTest.InvalidNullHandleQueue/*
-{{OPT}}urEnqueueWriteHostPipeTest.InvalidNullHandleProgram/*
-{{OPT}}urEnqueueWriteHostPipeTest.InvalidNullPointerPipeSymbol/*
-{{OPT}}urEnqueueWriteHostPipeTest.InvalidNullPointerBuffer/*
-{{OPT}}urEnqueueWriteHostPipeTest.InvalidEventWaitList/*
urEnqueueKernelLaunchIncrementMultiDeviceMultiThreadTest.Success/*
urEnqueueKernelLaunchIncrementMultiDeviceTest.Success/*
urEnqueueKernelLaunchIncrementTest.Success/*
diff --git a/test/conformance/enqueue/urEnqueueUSMFill2D.cpp b/test/conformance/enqueue/urEnqueueUSMFill2D.cpp
index 29123b57bd..e5d3186b81 100644
--- a/test/conformance/enqueue/urEnqueueUSMFill2D.cpp
+++ b/test/conformance/enqueue/urEnqueueUSMFill2D.cpp
@@ -134,9 +134,9 @@ TEST_P(urEnqueueUSMFill2DTestWithParam, Success) {
ur_event_handle_t event = nullptr;
- ASSERT_SUCCESS(urEnqueueUSMFill2D(queue, ptr, pitch, pattern_size,
- pattern.data(), width, height, 0, nullptr,
- &event));
+ UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(
+ urEnqueueUSMFill2D(queue, ptr, pitch, pattern_size, pattern.data(),
+ width, height, 0, nullptr, &event));
EXPECT_SUCCESS(urQueueFlush(queue));
ASSERT_SUCCESS(urEventWait(1, &event));
@@ -161,6 +161,11 @@ struct urEnqueueUSMFill2DNegativeTest : uur::urQueueTest {
ASSERT_SUCCESS(urUSMDeviceAlloc(context, device, nullptr, nullptr,
allocation_size, &ptr));
+
+ UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(
+ urEnqueueUSMFill2D(queue, ptr, pitch, pattern_size, pattern.data(),
+ width, height, 0, nullptr, nullptr));
+ ASSERT_SUCCESS(urQueueFinish(queue));
}
void TearDown() override {
diff --git a/test/conformance/exp_command_buffer/event_sync.cpp b/test/conformance/exp_command_buffer/event_sync.cpp
index a4356f8a29..d45785f2e3 100644
--- a/test/conformance/exp_command_buffer/event_sync.cpp
+++ b/test/conformance/exp_command_buffer/event_sync.cpp
@@ -75,6 +75,42 @@ TEST_P(CommandEventSyncTest, USMFillExp) {
}
}
+// Test fill using a large pattern size since implementations may need to handle
+// this differently.
+TEST_P(CommandEventSyncTest, USMFillLargePatternExp) {
+ // Device ptrs are allocated in the test fixture with 32-bit values * num
+ // elements, since we are doubling the pattern size we want to treat those
+ // device pointers as if they were created with half the number of elements.
+ constexpr size_t modifiedElementSize = elements / 2;
+ // Get wait event from queue fill on ptr 0
+ uint64_t patternX = 42;
+ ASSERT_SUCCESS(urEnqueueUSMFill(queue, device_ptrs[0], sizeof(patternX),
+ &patternX, allocation_size, 0, nullptr,
+ &external_events[0]));
+
+ // Test fill command overwriting ptr 0 waiting on queue event
+ uint64_t patternY = 0xA;
+ ASSERT_SUCCESS(urCommandBufferAppendUSMFillExp(
+ cmd_buf_handle, device_ptrs[0], &patternY, sizeof(patternY),
+ allocation_size, 0, nullptr, 1, &external_events[0], nullptr,
+ &external_events[1], nullptr));
+ ASSERT_SUCCESS(urCommandBufferFinalizeExp(cmd_buf_handle));
+ ASSERT_SUCCESS(
+ urCommandBufferEnqueueExp(cmd_buf_handle, queue, 0, nullptr, nullptr));
+
+ // Queue read ptr 0 based on event returned from command-buffer command
+ std::array host_enqueue_ptr{};
+ ASSERT_SUCCESS(urEnqueueUSMMemcpy(queue, false, host_enqueue_ptr.data(),
+ device_ptrs[0], allocation_size, 1,
+ &external_events[1], nullptr));
+
+ // Verify
+ ASSERT_SUCCESS(urQueueFinish(queue));
+ for (size_t i = 0; i < modifiedElementSize; i++) {
+ ASSERT_EQ(host_enqueue_ptr[i], patternY);
+ }
+}
+
TEST_P(CommandEventSyncTest, MemBufferCopyExp) {
// Get wait event from queue fill on buffer 0
uint32_t patternX = 42;
@@ -341,6 +377,42 @@ TEST_P(CommandEventSyncTest, MemBufferFillExp) {
}
}
+// Test fill using a large pattern size since implementations may need to handle
+// this differently.
+TEST_P(CommandEventSyncTest, MemBufferFillLargePatternExp) {
+ // Device buffers are allocated in the test fixture with 32-bit values * num
+ // elements, since we are doubling the pattern size we want to treat those
+ // device pointers as if they were created with half the number of elements.
+ constexpr size_t modifiedElementSize = elements / 2;
+ // Get wait event from queue fill on buffer 0
+ uint64_t patternX = 42;
+ ASSERT_SUCCESS(urEnqueueMemBufferFill(queue, buffers[0], &patternX,
+ sizeof(patternX), 0, allocation_size,
+ 0, nullptr, &external_events[0]));
+
+ // Test fill command overwriting buffer 0 based on queue event
+ uint64_t patternY = 0xA;
+ ASSERT_SUCCESS(urCommandBufferAppendMemBufferFillExp(
+ cmd_buf_handle, buffers[0], &patternY, sizeof(patternY), 0,
+ allocation_size, 0, nullptr, 1, &external_events[0], nullptr,
+ &external_events[1], nullptr));
+ ASSERT_SUCCESS(urCommandBufferFinalizeExp(cmd_buf_handle));
+ ASSERT_SUCCESS(
+ urCommandBufferEnqueueExp(cmd_buf_handle, queue, 0, nullptr, nullptr));
+
+ // Queue read buffer 0 based on event returned from command-buffer command
+ std::array host_enqueue_ptr{};
+ ASSERT_SUCCESS(urEnqueueMemBufferRead(
+ queue, buffers[0], false, 0, allocation_size, host_enqueue_ptr.data(),
+ 1, &external_events[1], nullptr));
+
+ // Verify
+ ASSERT_SUCCESS(urQueueFinish(queue));
+ for (size_t i = 0; i < modifiedElementSize; i++) {
+ ASSERT_EQ(host_enqueue_ptr[i], patternY);
+ }
+}
+
TEST_P(CommandEventSyncTest, USMPrefetchExp) {
// Get wait event from queue fill on ptr 0
uint32_t patternX = 42;
diff --git a/test/conformance/exp_command_buffer/exp_command_buffer_adapter_level_zero_v2.match b/test/conformance/exp_command_buffer/exp_command_buffer_adapter_level_zero_v2.match
index 5cd3d2a0ff..f6efce7966 100644
--- a/test/conformance/exp_command_buffer/exp_command_buffer_adapter_level_zero_v2.match
+++ b/test/conformance/exp_command_buffer/exp_command_buffer_adapter_level_zero_v2.match
@@ -33,6 +33,8 @@ CommandEventSyncTest.USMPrefetchExp/*
CommandEventSyncTest.USMAdviseExp/*
CommandEventSyncTest.MultipleEventCommands/*
CommandEventSyncTest.MultipleEventCommandsBetweenCommandBuffers/*
+CommandEventSyncTest.USMFillLargePatternExp/*
+CommandEventSyncTest.MemBufferFillLargePatternExp/*
CommandEventSyncUpdateTest.USMMemcpyExp/*
CommandEventSyncUpdateTest.USMFillExp/*
CommandEventSyncUpdateTest.MemBufferCopyExp/*
@@ -45,3 +47,5 @@ CommandEventSyncUpdateTest.MemBufferFillExp/*
CommandEventSyncUpdateTest.USMPrefetchExp/*
CommandEventSyncUpdateTest.USMAdviseExp/*
CommandEventSyncUpdateTest.MultipleEventCommands/*
+CommandEventSyncUpdateTest.USMFillLargePatternExp/*
+CommandEventSyncUpdateTest.MemBufferFillLargePatternExp/*
diff --git a/test/conformance/exp_command_buffer/update/event_sync.cpp b/test/conformance/exp_command_buffer/update/event_sync.cpp
index 13e1bed968..98e7ef469e 100644
--- a/test/conformance/exp_command_buffer/update/event_sync.cpp
+++ b/test/conformance/exp_command_buffer/update/event_sync.cpp
@@ -129,6 +129,68 @@ TEST_P(CommandEventSyncUpdateTest, USMFillExp) {
}
}
+// Test fill using a large pattern size since implementations may need to handle
+// this differently.
+TEST_P(CommandEventSyncUpdateTest, USMFillLargePatternExp) {
+ // Device ptrs are allocated in the test fixture with 32-bit values * num
+ // elements, since we are doubling the pattern size we want to treat those
+ // device pointers as if they were created with half the number of elements.
+ constexpr size_t modifiedElementSize = elements / 2;
+ // Get wait event from queue fill on ptr 0
+ uint64_t patternX = 42;
+ ASSERT_SUCCESS(urEnqueueUSMFill(queue, device_ptrs[0], sizeof(patternX),
+ &patternX, allocation_size, 0, nullptr,
+ &external_events[0]));
+
+ // Test fill command overwriting ptr 0 waiting on queue event
+ uint64_t patternY = 0xA;
+ ASSERT_SUCCESS(urCommandBufferAppendUSMFillExp(
+ updatable_cmd_buf_handle, device_ptrs[0], &patternY, sizeof(patternY),
+ allocation_size, 0, nullptr, 1, &external_events[0], nullptr,
+ &external_events[1], &command_handles[0]));
+ ASSERT_NE(nullptr, command_handles[0]);
+ ASSERT_SUCCESS(urCommandBufferFinalizeExp(updatable_cmd_buf_handle));
+ ASSERT_SUCCESS(urCommandBufferEnqueueExp(updatable_cmd_buf_handle, queue, 0,
+ nullptr, nullptr));
+
+ // Queue read ptr 0 based on event returned from command-buffer command
+ std::array host_enqueue_ptr{};
+ ASSERT_SUCCESS(urEnqueueUSMMemcpy(queue, false, host_enqueue_ptr.data(),
+ device_ptrs[0], allocation_size, 1,
+ &external_events[1], nullptr));
+
+ // Verify
+ ASSERT_SUCCESS(urQueueFinish(queue));
+ for (size_t i = 0; i < modifiedElementSize; i++) {
+ ASSERT_EQ(host_enqueue_ptr[i], patternY);
+ }
+
+ uint64_t patternZ = 666;
+ ASSERT_SUCCESS(urEnqueueUSMFill(queue, device_ptrs[0], sizeof(patternZ),
+ &patternZ, allocation_size, 0, nullptr,
+ &external_events[2]));
+
+ // Update command command-wait event to wait on fill of new value
+ ASSERT_SUCCESS(urCommandBufferUpdateWaitEventsExp(command_handles[0], 1,
+ &external_events[2]));
+
+ // Get a new signal event for command-buffer
+ ASSERT_SUCCESS(urCommandBufferUpdateSignalEventExp(command_handles[0],
+ &external_events[3]));
+ ASSERT_SUCCESS(urCommandBufferEnqueueExp(updatable_cmd_buf_handle, queue, 0,
+ nullptr, nullptr));
+
+ ASSERT_SUCCESS(urEnqueueUSMMemcpy(queue, false, host_enqueue_ptr.data(),
+ device_ptrs[0], allocation_size, 1,
+ &external_events[3], nullptr));
+
+ // Verify update
+ ASSERT_SUCCESS(urQueueFinish(queue));
+ for (size_t i = 0; i < modifiedElementSize; i++) {
+ ASSERT_EQ(host_enqueue_ptr[i], patternY);
+ }
+}
+
TEST_P(CommandEventSyncUpdateTest, MemBufferCopyExp) {
// Get wait event from queue fill on buffer 0
uint32_t patternX = 42;
@@ -532,6 +594,68 @@ TEST_P(CommandEventSyncUpdateTest, MemBufferWriteRectExp) {
}
}
+// Test fill using a large pattern size since implementations may need to handle
+// this differently.
+TEST_P(CommandEventSyncUpdateTest, MemBufferFillLargePatternExp) {
+ // Device buffers are allocated in the test fixture with 32-bit values * num
+ // elements, since we are doubling the pattern size we want to treat those
+ // device pointers as if they were created with half the number of elements.
+ constexpr size_t modifiedElementSize = elements / 2;
+ // Get wait event from queue fill on buffer 0
+ uint64_t patternX = 42;
+ ASSERT_SUCCESS(urEnqueueMemBufferFill(queue, buffers[0], &patternX,
+ sizeof(patternX), 0, allocation_size,
+ 0, nullptr, &external_events[0]));
+
+ // Test fill command overwriting buffer 0 based on queue event
+ uint64_t patternY = 0xA;
+ ASSERT_SUCCESS(urCommandBufferAppendMemBufferFillExp(
+ updatable_cmd_buf_handle, buffers[0], &patternY, sizeof(patternY), 0,
+ allocation_size, 0, nullptr, 1, &external_events[0], nullptr,
+ &external_events[1], &command_handles[0]));
+ ASSERT_NE(nullptr, command_handles[0]);
+ ASSERT_SUCCESS(urCommandBufferFinalizeExp(updatable_cmd_buf_handle));
+ ASSERT_SUCCESS(urCommandBufferEnqueueExp(updatable_cmd_buf_handle, queue, 0,
+ nullptr, nullptr));
+
+ // Queue read buffer 0 based on event returned from command-buffer command
+ std::array host_enqueue_ptr{};
+ ASSERT_SUCCESS(urEnqueueMemBufferRead(
+ queue, buffers[0], false, 0, allocation_size, host_enqueue_ptr.data(),
+ 1, &external_events[1], nullptr));
+
+ // Verify
+ ASSERT_SUCCESS(urQueueFinish(queue));
+ for (size_t i = 0; i < modifiedElementSize; i++) {
+ ASSERT_EQ(host_enqueue_ptr[i], patternY);
+ }
+
+ uint64_t patternZ = 666;
+ ASSERT_SUCCESS(urEnqueueMemBufferFill(queue, buffers[0], &patternZ,
+ sizeof(patternZ), 0, allocation_size,
+ 0, nullptr, &external_events[2]));
+
+ // Update command command-wait event to wait on fill of new value
+ ASSERT_SUCCESS(urCommandBufferUpdateWaitEventsExp(command_handles[0], 1,
+ &external_events[2]));
+
+ // Get a new signal event for command-buffer
+ ASSERT_SUCCESS(urCommandBufferUpdateSignalEventExp(command_handles[0],
+ &external_events[3]));
+
+ ASSERT_SUCCESS(urCommandBufferEnqueueExp(updatable_cmd_buf_handle, queue, 0,
+ nullptr, nullptr));
+ ASSERT_SUCCESS(urEnqueueMemBufferRead(
+ queue, buffers[0], false, 0, allocation_size, host_enqueue_ptr.data(),
+ 1, &external_events[3], nullptr));
+
+ // Verify update
+ ASSERT_SUCCESS(urQueueFinish(queue));
+ for (size_t i = 0; i < modifiedElementSize; i++) {
+ ASSERT_EQ(host_enqueue_ptr[i], patternY);
+ }
+}
+
TEST_P(CommandEventSyncUpdateTest, MemBufferFillExp) {
// Get wait event from queue fill on buffer 0
uint32_t patternX = 42;
diff --git a/test/conformance/memory-migrate/urMemBufferMigrateAcrossDevices.cpp b/test/conformance/memory-migrate/urMemBufferMigrateAcrossDevices.cpp
index f7617a2940..040634898f 100644
--- a/test/conformance/memory-migrate/urMemBufferMigrateAcrossDevices.cpp
+++ b/test/conformance/memory-migrate/urMemBufferMigrateAcrossDevices.cpp
@@ -148,8 +148,9 @@ struct urMultiDeviceContextMemBufferTest : urMultiDeviceContextTest {
std::vector kernels;
std::vector metadatas{};
};
+UUR_INSTANTIATE_PLATFORM_TEST_SUITE_P(urMultiDeviceContextMemBufferTest);
-TEST_F(urMultiDeviceContextMemBufferTest, WriteRead) {
+TEST_P(urMultiDeviceContextMemBufferTest, WriteRead) {
if (num_devices == 1) {
GTEST_SKIP();
}
@@ -173,7 +174,7 @@ TEST_F(urMultiDeviceContextMemBufferTest, WriteRead) {
}
}
-TEST_F(urMultiDeviceContextMemBufferTest, FillRead) {
+TEST_P(urMultiDeviceContextMemBufferTest, FillRead) {
if (num_devices == 1) {
GTEST_SKIP();
}
@@ -197,7 +198,7 @@ TEST_F(urMultiDeviceContextMemBufferTest, FillRead) {
}
}
-TEST_F(urMultiDeviceContextMemBufferTest, WriteKernelRead) {
+TEST_P(urMultiDeviceContextMemBufferTest, WriteKernelRead) {
if (num_devices == 1) {
GTEST_SKIP();
}
@@ -233,7 +234,7 @@ TEST_F(urMultiDeviceContextMemBufferTest, WriteKernelRead) {
}
}
-TEST_F(urMultiDeviceContextMemBufferTest, WriteKernelKernelRead) {
+TEST_P(urMultiDeviceContextMemBufferTest, WriteKernelKernelRead) {
if (num_devices == 1) {
GTEST_SKIP();
}
diff --git a/test/conformance/memory/memory_adapter_level_zero_v2.match b/test/conformance/memory/memory_adapter_level_zero_v2.match
deleted file mode 100644
index ec09c7b5ef..0000000000
--- a/test/conformance/memory/memory_adapter_level_zero_v2.match
+++ /dev/null
@@ -1,15 +0,0 @@
-{{OPT}}urMemBufferPartitionWithFlagsTest.Success/*
-{{OPT}}urMemBufferPartitionTest.InvalidValueCreateType/*
-{{OPT}}urMemBufferPartitionTest.InvalidValueBufferCreateInfoOutOfBounds/*
-{{OPT}}urMemGetInfoImageTest.Success/*
-{{OPT}}urMemImageCreateTestWithImageFormatParam.Success/*
-{{OPT}}urMemImageGetInfoTest.Success/*
-{{OPT}}urMemImageGetInfoTest.InvalidNullHandleImage/*
-{{OPT}}urMemImageGetInfoTest.InvalidEnumerationImageInfoType/*
-{{OPT}}urMemImageGetInfoTest.InvalidSizeZero/*
-{{OPT}}urMemImageGetInfoTest.InvalidSizeSmall/*
-{{OPT}}urMemImageGetInfoTest.InvalidNullPointerParamValue/*
-{{OPT}}urMemImageGetInfoTest.InvalidNullPointerPropSizeRet/*
-{{OPT}}urMemImageCreateWithNativeHandleTest.Success/*
-{{OPT}}urMemImageCreateWithNativeHandleTest.InvalidNullHandle/*
-{{OPT}}urMemImageCreateWithNativeHandleTest.InvalidNullPointer/*
diff --git a/test/conformance/memory/memory_adapter_native_cpu.match b/test/conformance/memory/memory_adapter_native_cpu.match
index aafd22075c..4465185bed 100644
--- a/test/conformance/memory/memory_adapter_native_cpu.match
+++ b/test/conformance/memory/memory_adapter_native_cpu.match
@@ -4,7 +4,6 @@ urMemBufferPartitionTest.InvalidValueCreateType/*
urMemBufferPartitionTest.InvalidValueBufferCreateInfoOutOfBounds/*
urMemGetInfoTestWithParam.Success/*
urMemGetInfoTest.InvalidSizeSmall/*
-urMemImageCreateTestWithImageFormatParam.Success/*
urMemReleaseTest.Success/*
urMemReleaseTest.CheckReferenceCount/*
urMemRetainTest.Success/*
diff --git a/test/conformance/memory/urMemImageCreateWithImageFormatParam.cpp b/test/conformance/memory/urMemImageCreateWithImageFormatParam.cpp
index c305f58f00..b72b5a9425 100644
--- a/test/conformance/memory/urMemImageCreateWithImageFormatParam.cpp
+++ b/test/conformance/memory/urMemImageCreateWithImageFormatParam.cpp
@@ -110,6 +110,10 @@ TEST_P(urMemImageCreateTestWithImageFormatParam, Success) {
}
}
+ if (res == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
+ GTEST_SKIP() << "urMemImageCreate not supported";
+ }
+
if (!is_primary_image_format &&
res == UR_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT) {
GTEST_SKIP();
diff --git a/test/conformance/memory/urMemImageCreateWithNativeHandle.cpp b/test/conformance/memory/urMemImageCreateWithNativeHandle.cpp
index c33cc814a3..a881af0752 100644
--- a/test/conformance/memory/urMemImageCreateWithNativeHandle.cpp
+++ b/test/conformance/memory/urMemImageCreateWithNativeHandle.cpp
@@ -10,7 +10,8 @@ UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urMemImageCreateWithNativeHandleTest);
TEST_P(urMemImageCreateWithNativeHandleTest, Success) {
ur_native_handle_t native_handle = 0;
- ASSERT_SUCCESS(urMemGetNativeHandle(image, device, &native_handle));
+ UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(
+ urMemGetNativeHandle(image, device, &native_handle));
ur_mem_handle_t mem = nullptr;
ASSERT_SUCCESS(urMemImageCreateWithNativeHandle(
diff --git a/test/conformance/platform/CMakeLists.txt b/test/conformance/platform/CMakeLists.txt
index eec1e9bee3..e07689324b 100644
--- a/test/conformance/platform/CMakeLists.txt
+++ b/test/conformance/platform/CMakeLists.txt
@@ -3,7 +3,7 @@
# See LICENSE.TXT
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-add_conformance_test(platform
+add_conformance_test_with_platform_environment(platform
urPlatformCreateWithNativeHandle.cpp
urPlatformGet.cpp
urPlatformGetApiVersion.cpp
diff --git a/test/conformance/platform/fixtures.h b/test/conformance/platform/fixtures.h
index a11426b25c..60928d50c0 100644
--- a/test/conformance/platform/fixtures.h
+++ b/test/conformance/platform/fixtures.h
@@ -7,76 +7,42 @@
#define UR_CONFORMANCE_PLATFORM_FIXTURES_H_INCLUDED
#include
+#include
+
namespace uur {
namespace platform {
-struct urTest : ::testing::Test {
-
- void SetUp() override {
- ur_device_init_flags_t device_flags = 0;
- ASSERT_SUCCESS(urLoaderConfigCreate(&loader_config));
- ASSERT_SUCCESS(urLoaderConfigEnableLayer(loader_config,
- "UR_LAYER_FULL_VALIDATION"));
- ASSERT_SUCCESS(urLoaderInit(device_flags, loader_config));
-
- uint32_t adapter_count;
- ASSERT_SUCCESS(urAdapterGet(0, nullptr, &adapter_count));
- adapters.resize(adapter_count);
- ASSERT_SUCCESS(urAdapterGet(adapter_count, adapters.data(), nullptr));
- }
-
- void TearDown() override {
- for (auto adapter : adapters) {
- ASSERT_SUCCESS(urAdapterRelease(adapter));
- }
- if (loader_config) {
- ASSERT_SUCCESS(urLoaderConfigRelease(loader_config));
- }
- ASSERT_SUCCESS(urLoaderTearDown());
- }
-
- ur_loader_config_handle_t loader_config = nullptr;
- std::vector adapters;
-};
-
-struct urPlatformsTest : urTest {
-
- void SetUp() override {
- UUR_RETURN_ON_FATAL_FAILURE(urTest::SetUp());
- uint32_t count;
- ASSERT_SUCCESS(urPlatformGet(adapters.data(),
- static_cast(adapters.size()), 0,
- nullptr, &count));
- ASSERT_NE(count, 0);
- platforms.resize(count);
- ASSERT_SUCCESS(urPlatformGet(adapters.data(),
- static_cast(adapters.size()),
- count, platforms.data(), nullptr));
- }
-
- std::vector platforms;
+template
+struct urPlatformTestWithParam
+ : ::testing::Test,
+ ::testing::WithParamInterface> {
+ void SetUp() override { platform = std::get<0>(this->GetParam()); }
+ const T &getParam() const { return std::get<1>(this->GetParam()); }
+ ur_platform_handle_t platform;
};
-struct urPlatformTest : urPlatformsTest {
+template
+std::string platformTestWithParamPrinter(
+ const ::testing::TestParamInfo> &info) {
+ auto platform = std::get<0>(info.param);
+ auto param = std::get<1>(info.param);
- void SetUp() override {
- UUR_RETURN_ON_FATAL_FAILURE(urPlatformsTest::SetUp());
- ASSERT_GE(platforms.size(), 1);
- platform = platforms[0]; // TODO - which to choose?
- }
+ std::stringstream ss;
+ ss << param;
+ return uur::GetPlatformNameWithID(platform) + "__" +
+ GTestSanitizeString(ss.str());
+}
- ur_platform_handle_t platform;
-};
+} // namespace platform
+} // namespace uur
-#define UUR_INSTANTIATE_PLATFORM_TEST_SUITE_P(FIXTURE) \
+#define UUR_PLATFORM_TEST_SUITE_P(FIXTURE, VALUES, TYPE) \
INSTANTIATE_TEST_SUITE_P( \
, FIXTURE, \
- ::testing::ValuesIn(uur::DevicesEnvironment::instance->devices), \
- [](const ::testing::TestParamInfo &info) { \
- return uur::GetPlatformAndDeviceName(info.param); \
- })
-
-} // namespace platform
-} // namespace uur
+ testing::Combine( \
+ ::testing::ValuesIn( \
+ uur::PlatformEnvironment::instance->all_platforms), \
+ VALUES), \
+ uur::platform::platformTestWithParamPrinter)
#endif // UR_CONFORMANCE_PLATFORM_FIXTURES_H_INCLUDED
diff --git a/test/conformance/platform/urPlatformCreateWithNativeHandle.cpp b/test/conformance/platform/urPlatformCreateWithNativeHandle.cpp
index 6b56f9b661..763c6efcac 100644
--- a/test/conformance/platform/urPlatformCreateWithNativeHandle.cpp
+++ b/test/conformance/platform/urPlatformCreateWithNativeHandle.cpp
@@ -3,87 +3,88 @@
// See LICENSE.TXT
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#include "fixtures.h"
+#include
-using urPlatformCreateWithNativeHandleTest = uur::platform::urPlatformTest;
+struct urPlatformCreateWithNativeHandleTest : uur::urPlatformTest {
+ void SetUp() override {
+ UUR_RETURN_ON_FATAL_FAILURE(uur::urPlatformTest::SetUp());
+ ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_ADAPTER,
+ sizeof(ur_adapter_handle_t), &adapter,
+ nullptr));
+ }
+ ur_adapter_handle_t adapter = nullptr;
+};
+UUR_INSTANTIATE_PLATFORM_TEST_SUITE_P(urPlatformCreateWithNativeHandleTest);
-TEST_F(urPlatformCreateWithNativeHandleTest, Success) {
- for (auto platform : platforms) {
- ur_native_handle_t native_handle = 0;
+TEST_P(urPlatformCreateWithNativeHandleTest, Success) {
+ ur_native_handle_t native_handle = 0;
- UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(
- urPlatformGetNativeHandle(platform, &native_handle));
+ UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(
+ urPlatformGetNativeHandle(platform, &native_handle));
- // We cannot assume anything about a native_handle, not even if it's
- // `nullptr` since this could be a valid representation within a backend.
- // We can however convert the native_handle back into a unified-runtime
- // handle and perform some query on it to verify that it works.
- ur_platform_handle_t plat = nullptr;
- UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(urPlatformCreateWithNativeHandle(
- native_handle, adapters[0], nullptr, &plat));
- ASSERT_NE(plat, nullptr);
+ // We cannot assume anything about a native_handle, not even if it's
+ // `nullptr` since this could be a valid representation within a backend.
+ // We can however convert the native_handle back into a unified-runtime
+ // handle and perform some query on it to verify that it works.
+ ur_platform_handle_t plat = nullptr;
+ UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(urPlatformCreateWithNativeHandle(
+ native_handle, adapter, nullptr, &plat));
+ ASSERT_NE(plat, nullptr);
- std::string input_platform_name = uur::GetPlatformName(platform);
- std::string created_platform_name = uur::GetPlatformName(plat);
- ASSERT_EQ(input_platform_name, created_platform_name);
- }
+ std::string input_platform_name = uur::GetPlatformName(platform);
+ std::string created_platform_name = uur::GetPlatformName(plat);
+ ASSERT_EQ(input_platform_name, created_platform_name);
}
-TEST_F(urPlatformCreateWithNativeHandleTest, SuccessWithOwnedNativeHandle) {
- for (auto platform : platforms) {
- ur_native_handle_t native_handle = 0;
+TEST_P(urPlatformCreateWithNativeHandleTest, SuccessWithOwnedNativeHandle) {
+ ur_native_handle_t native_handle = 0;
- UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(
- urPlatformGetNativeHandle(platform, &native_handle));
+ UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(
+ urPlatformGetNativeHandle(platform, &native_handle));
- // We cannot assume anything about a native_handle, not even if it's
- // `nullptr` since this could be a valid representation within a backend.
- // We can however convert the native_handle back into a unified-runtime
- // handle and perform some query on it to verify that it works.
- ur_platform_native_properties_t props = {
- UR_STRUCTURE_TYPE_PLATFORM_NATIVE_PROPERTIES, nullptr, true};
- ur_platform_handle_t plat = nullptr;
- UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(urPlatformCreateWithNativeHandle(
- native_handle, adapters[0], &props, &plat));
- ASSERT_NE(plat, nullptr);
+ // We cannot assume anything about a native_handle, not even if it's
+ // `nullptr` since this could be a valid representation within a backend.
+ // We can however convert the native_handle back into a unified-runtime
+ // handle and perform some query on it to verify that it works.
+ ur_platform_native_properties_t props = {
+ UR_STRUCTURE_TYPE_PLATFORM_NATIVE_PROPERTIES, nullptr, true};
+ ur_platform_handle_t plat = nullptr;
+ UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(urPlatformCreateWithNativeHandle(
+ native_handle, adapter, &props, &plat));
+ ASSERT_NE(plat, nullptr);
- std::string input_platform_name = uur::GetPlatformName(platform);
- std::string created_platform_name = uur::GetPlatformName(plat);
- ASSERT_EQ(input_platform_name, created_platform_name);
- }
+ std::string input_platform_name = uur::GetPlatformName(platform);
+ std::string created_platform_name = uur::GetPlatformName(plat);
+ ASSERT_EQ(input_platform_name, created_platform_name);
}
-TEST_F(urPlatformCreateWithNativeHandleTest, SuccessWithUnOwnedNativeHandle) {
- for (auto platform : platforms) {
- ur_native_handle_t native_handle = 0;
+TEST_P(urPlatformCreateWithNativeHandleTest, SuccessWithUnOwnedNativeHandle) {
+ ur_native_handle_t native_handle = 0;
- UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(
- urPlatformGetNativeHandle(platform, &native_handle));
+ UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(
+ urPlatformGetNativeHandle(platform, &native_handle));
- // We cannot assume anything about a native_handle, not even if it's
- // `nullptr` since this could be a valid representation within a backend.
- // We can however convert the native_handle back into a unified-runtime
- // handle and perform some query on it to verify that it works.
- ur_platform_native_properties_t props = {
- UR_STRUCTURE_TYPE_PLATFORM_NATIVE_PROPERTIES, nullptr, false};
- ur_platform_handle_t plat = nullptr;
- UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(urPlatformCreateWithNativeHandle(
- native_handle, adapters[0], &props, &plat));
- ASSERT_NE(plat, nullptr);
+ // We cannot assume anything about a native_handle, not even if it's
+ // `nullptr` since this could be a valid representation within a backend.
+ // We can however convert the native_handle back into a unified-runtime
+ // handle and perform some query on it to verify that it works.
+ ur_platform_native_properties_t props = {
+ UR_STRUCTURE_TYPE_PLATFORM_NATIVE_PROPERTIES, nullptr, false};
+ ur_platform_handle_t plat = nullptr;
+ UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(urPlatformCreateWithNativeHandle(
+ native_handle, adapter, &props, &plat));
+ ASSERT_NE(plat, nullptr);
- std::string input_platform_name = uur::GetPlatformName(platform);
- std::string created_platform_name = uur::GetPlatformName(plat);
- ASSERT_EQ(input_platform_name, created_platform_name);
- }
+ std::string input_platform_name = uur::GetPlatformName(platform);
+ std::string created_platform_name = uur::GetPlatformName(plat);
+ ASSERT_EQ(input_platform_name, created_platform_name);
}
-TEST_F(urPlatformCreateWithNativeHandleTest, InvalidNullPointerPlatform) {
- for (auto platform : platforms) {
- ur_native_handle_t native_handle = 0;
- UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(
- urPlatformGetNativeHandle(platform, &native_handle));
- ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_POINTER,
- urPlatformCreateWithNativeHandle(
- native_handle, adapters[0], nullptr, nullptr));
- }
+TEST_P(urPlatformCreateWithNativeHandleTest, InvalidNullPointerPlatform) {
+ ur_native_handle_t native_handle = 0;
+ UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(
+ urPlatformGetNativeHandle(platform, &native_handle));
+ ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_POINTER,
+ urPlatformCreateWithNativeHandle(native_handle, adapter,
+ nullptr, nullptr));
}
diff --git a/test/conformance/platform/urPlatformGet.cpp b/test/conformance/platform/urPlatformGet.cpp
index 20f12c16df..b7305a066d 100644
--- a/test/conformance/platform/urPlatformGet.cpp
+++ b/test/conformance/platform/urPlatformGet.cpp
@@ -3,9 +3,12 @@
// See LICENSE.TXT
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#include "fixtures.h"
+#include
-using urPlatformGetTest = uur::platform::urTest;
+struct urPlatformGetTest : ::testing::Test {
+ std::vector &adapters =
+ uur::PlatformEnvironment::instance->adapters;
+};
TEST_F(urPlatformGetTest, Success) {
uint32_t count;
diff --git a/test/conformance/platform/urPlatformGetApiVersion.cpp b/test/conformance/platform/urPlatformGetApiVersion.cpp
index 10279d560a..f3571f9a58 100644
--- a/test/conformance/platform/urPlatformGetApiVersion.cpp
+++ b/test/conformance/platform/urPlatformGetApiVersion.cpp
@@ -3,24 +3,25 @@
// See LICENSE.TXT
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#include "fixtures.h"
+#include
-using urPlatformGetApiVersionTest = uur::platform::urPlatformTest;
+using urPlatformGetApiVersionTest = uur::urPlatformTest;
+UUR_INSTANTIATE_PLATFORM_TEST_SUITE_P(urPlatformGetApiVersionTest);
-TEST_F(urPlatformGetApiVersionTest, Success) {
+TEST_P(urPlatformGetApiVersionTest, Success) {
ur_api_version_t version;
ASSERT_EQ_RESULT(UR_RESULT_SUCCESS,
urPlatformGetApiVersion(platform, &version));
ASSERT_GE(UR_API_VERSION_CURRENT, version);
}
-TEST_F(urPlatformGetApiVersionTest, InvalidPlatform) {
+TEST_P(urPlatformGetApiVersionTest, InvalidPlatform) {
ur_api_version_t version;
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_HANDLE,
urPlatformGetApiVersion(nullptr, &version));
}
-TEST_F(urPlatformGetApiVersionTest, InvalidVersionPtr) {
+TEST_P(urPlatformGetApiVersionTest, InvalidVersionPtr) {
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_POINTER,
urPlatformGetApiVersion(platform, nullptr));
}
diff --git a/test/conformance/platform/urPlatformGetBackendOption.cpp b/test/conformance/platform/urPlatformGetBackendOption.cpp
index 06ac618580..30d59013df 100644
--- a/test/conformance/platform/urPlatformGetBackendOption.cpp
+++ b/test/conformance/platform/urPlatformGetBackendOption.cpp
@@ -4,45 +4,45 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include "fixtures.h"
-struct urPlatfromGetBackendOptionTestWithParam
- : uur::platform::urPlatformTest,
- ::testing::WithParamInterface {};
+using urPlatformGetBackendOptionTest =
+ uur::platform::urPlatformTestWithParam;
-INSTANTIATE_TEST_SUITE_P(, urPlatfromGetBackendOptionTestWithParam,
- ::testing::Values("-O0", "-O1", "-O2", "-O3"),
- [](const ::testing::TestParamInfo &info) {
- return uur::GTestSanitizeString(info.param);
- });
+UUR_PLATFORM_TEST_SUITE_P(urPlatformGetBackendOptionTest,
+ ::testing::Values("-O0", "-O1", "-O2", "-O3"),
+ std::string);
-TEST_P(urPlatfromGetBackendOptionTestWithParam, Success) {
+TEST_P(urPlatformGetBackendOptionTest, Success) {
const char *platformOption = nullptr;
- ASSERT_SUCCESS(urPlatformGetBackendOption(platform, GetParam().c_str(),
+ ASSERT_SUCCESS(urPlatformGetBackendOption(platform, getParam().c_str(),
&platformOption));
ASSERT_NE(platformOption, nullptr);
}
-using urPlatfromGetBackendOptionTest = uur::platform::urPlatformTest;
+using urPlatformGetBackendOptionNegativeTest = uur::urPlatformTest;
+UUR_INSTANTIATE_PLATFORM_TEST_SUITE_P(urPlatformGetBackendOptionNegativeTest);
-TEST_F(urPlatfromGetBackendOptionTest, InvalidNullHandle) {
+TEST_P(urPlatformGetBackendOptionNegativeTest, InvalidNullHandle) {
const char *platformOption = nullptr;
ASSERT_EQ_RESULT(
UR_RESULT_ERROR_INVALID_NULL_HANDLE,
urPlatformGetBackendOption(nullptr, "-O0", &platformOption));
}
-TEST_F(urPlatfromGetBackendOptionTest, InvalidNullPointerFrontendOption) {
+TEST_P(urPlatformGetBackendOptionNegativeTest,
+ InvalidNullPointerFrontendOption) {
const char *platformOption = nullptr;
ASSERT_EQ_RESULT(
UR_RESULT_ERROR_INVALID_NULL_POINTER,
urPlatformGetBackendOption(platform, nullptr, &platformOption));
}
-TEST_F(urPlatfromGetBackendOptionTest, InvalidNullPointerPlatformOption) {
+TEST_P(urPlatformGetBackendOptionNegativeTest,
+ InvalidNullPointerPlatformOption) {
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_POINTER,
urPlatformGetBackendOption(platform, "-O0", nullptr));
}
-TEST_F(urPlatfromGetBackendOptionTest, InvalidValueFrontendOption) {
+TEST_P(urPlatformGetBackendOptionNegativeTest, InvalidValueFrontendOption) {
const char *platformOption = nullptr;
ASSERT_EQ_RESULT(
UR_RESULT_ERROR_INVALID_VALUE,
diff --git a/test/conformance/platform/urPlatformGetInfo.cpp b/test/conformance/platform/urPlatformGetInfo.cpp
index 8535b42b5b..5f3e422740 100644
--- a/test/conformance/platform/urPlatformGetInfo.cpp
+++ b/test/conformance/platform/urPlatformGetInfo.cpp
@@ -4,32 +4,24 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include "fixtures.h"
+#include "uur/environment.h"
+#include "uur/fixtures.h"
#include
-struct urPlatformGetInfoTest
- : uur::platform::urPlatformTest,
- ::testing::WithParamInterface {
+using urPlatformGetInfoTest =
+ uur::platform::urPlatformTestWithParam;
- void SetUp() {
- UUR_RETURN_ON_FATAL_FAILURE(uur::platform::urPlatformTest::SetUp());
- }
-};
-
-INSTANTIATE_TEST_SUITE_P(
- urPlatformGetInfo, urPlatformGetInfoTest,
+UUR_PLATFORM_TEST_SUITE_P(
+ urPlatformGetInfoTest,
::testing::Values(UR_PLATFORM_INFO_NAME, UR_PLATFORM_INFO_VENDOR_NAME,
UR_PLATFORM_INFO_VERSION, UR_PLATFORM_INFO_EXTENSIONS,
UR_PLATFORM_INFO_PROFILE, UR_PLATFORM_INFO_BACKEND,
UR_PLATFORM_INFO_ADAPTER),
- [](const ::testing::TestParamInfo &info) {
- std::stringstream ss;
- ss << info.param;
- return ss.str();
- });
+ ur_platform_info_t);
TEST_P(urPlatformGetInfoTest, Success) {
size_t size = 0;
- ur_platform_info_t info_type = GetParam();
+ ur_platform_info_t info_type = getParam();
ASSERT_SUCCESS_OR_OPTIONAL_QUERY(
urPlatformGetInfo(platform, info_type, 0, nullptr, &size), info_type);
if (info_type == UR_PLATFORM_INFO_BACKEND) {
@@ -57,8 +49,11 @@ TEST_P(urPlatformGetInfoTest, Success) {
auto queried_adapter =
*reinterpret_cast(name.data());
auto adapter_found =
- std::find(adapters.begin(), adapters.end(), queried_adapter);
- ASSERT_NE(adapter_found, adapters.end());
+ std::find(uur::PlatformEnvironment::instance->adapters.begin(),
+ uur::PlatformEnvironment::instance->adapters.end(),
+ queried_adapter);
+ ASSERT_NE(adapter_found,
+ uur::AdapterEnvironment::instance->adapters.end());
break;
}
default:
@@ -69,38 +64,41 @@ TEST_P(urPlatformGetInfoTest, Success) {
TEST_P(urPlatformGetInfoTest, InvalidNullHandlePlatform) {
size_t size = 0;
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_HANDLE,
- urPlatformGetInfo(nullptr, GetParam(), 0, nullptr, &size));
+ urPlatformGetInfo(nullptr, getParam(), 0, nullptr, &size));
}
-TEST_F(urPlatformGetInfoTest, InvalidEnumerationPlatformInfoType) {
+using urPlatformGetInfoNegativeTest = uur::urPlatformTest;
+UUR_INSTANTIATE_PLATFORM_TEST_SUITE_P(urPlatformGetInfoNegativeTest);
+
+TEST_P(urPlatformGetInfoNegativeTest, InvalidEnumerationPlatformInfoType) {
size_t size = 0;
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_ENUMERATION,
urPlatformGetInfo(platform, UR_PLATFORM_INFO_FORCE_UINT32,
0, nullptr, &size));
}
-TEST_F(urPlatformGetInfoTest, InvalidSizeZero) {
+TEST_P(urPlatformGetInfoNegativeTest, InvalidSizeZero) {
ur_platform_backend_t backend;
ASSERT_EQ_RESULT(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, 0,
&backend, nullptr),
UR_RESULT_ERROR_INVALID_SIZE);
}
-TEST_F(urPlatformGetInfoTest, InvalidSizeSmall) {
+TEST_P(urPlatformGetInfoNegativeTest, InvalidSizeSmall) {
ur_platform_backend_t backend;
ASSERT_EQ_RESULT(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND,
sizeof(backend) - 1, &backend, nullptr),
UR_RESULT_ERROR_INVALID_SIZE);
}
-TEST_F(urPlatformGetInfoTest, InvalidNullPointerPropValue) {
+TEST_P(urPlatformGetInfoNegativeTest, InvalidNullPointerPropValue) {
ur_platform_backend_t backend;
ASSERT_EQ_RESULT(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND,
sizeof(backend), nullptr, nullptr),
UR_RESULT_ERROR_INVALID_NULL_POINTER);
}
-TEST_F(urPlatformGetInfoTest, InvalidNullPointerPropSizeRet) {
+TEST_P(urPlatformGetInfoNegativeTest, InvalidNullPointerPropSizeRet) {
ASSERT_EQ_RESULT(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, 0,
nullptr, nullptr),
UR_RESULT_ERROR_INVALID_NULL_POINTER);
diff --git a/test/conformance/platform/urPlatformGetNativeHandle.cpp b/test/conformance/platform/urPlatformGetNativeHandle.cpp
index 305eed5eda..ba4e29986f 100644
--- a/test/conformance/platform/urPlatformGetNativeHandle.cpp
+++ b/test/conformance/platform/urPlatformGetNativeHandle.cpp
@@ -3,28 +3,25 @@
// See LICENSE.TXT
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#include "fixtures.h"
+#include
-using urPlatformGetNativeHandleTest = uur::platform::urPlatformsTest;
+using urPlatformGetNativeHandleTest = uur::urPlatformTest;
+UUR_INSTANTIATE_PLATFORM_TEST_SUITE_P(urPlatformGetNativeHandleTest);
-TEST_F(urPlatformGetNativeHandleTest, Success) {
- for (auto platform : platforms) {
- ur_native_handle_t native_handle = 0;
- if (auto error = urPlatformGetNativeHandle(platform, &native_handle)) {
- ASSERT_EQ(UR_RESULT_ERROR_UNSUPPORTED_FEATURE, error);
- }
+TEST_P(urPlatformGetNativeHandleTest, Success) {
+ ur_native_handle_t native_handle = 0;
+ if (auto error = urPlatformGetNativeHandle(platform, &native_handle)) {
+ ASSERT_EQ(UR_RESULT_ERROR_UNSUPPORTED_FEATURE, error);
}
}
-TEST_F(urPlatformGetNativeHandleTest, InvalidNullHandlePlatform) {
+TEST_P(urPlatformGetNativeHandleTest, InvalidNullHandlePlatform) {
ur_native_handle_t native_handle = 0;
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_HANDLE,
urPlatformGetNativeHandle(nullptr, &native_handle));
}
-TEST_F(urPlatformGetNativeHandleTest, InvalidNullPointerNativePlatform) {
- for (auto platform : platforms) {
- ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_POINTER,
- urPlatformGetNativeHandle(platform, nullptr));
- }
+TEST_P(urPlatformGetNativeHandleTest, InvalidNullPointerNativePlatform) {
+ ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_POINTER,
+ urPlatformGetNativeHandle(platform, nullptr));
}
diff --git a/test/conformance/source/environment.cpp b/test/conformance/source/environment.cpp
index e1d1951616..037ab4c882 100644
--- a/test/conformance/source/environment.cpp
+++ b/test/conformance/source/environment.cpp
@@ -145,6 +145,7 @@ void uur::PlatformEnvironment::selectPlatformFromOptions() {
urPlatformGet(&a, 1, count, platform_list.data(), nullptr));
for (auto p : platform_list) {
+ all_platforms.push_back(p);
ur_platform_backend_t backend;
ASSERT_SUCCESS(urPlatformGetInfo(p, UR_PLATFORM_INFO_BACKEND,
sizeof(ur_platform_backend_t),
diff --git a/test/conformance/testing/include/uur/environment.h b/test/conformance/testing/include/uur/environment.h
index 397858333f..3d6c2cc0e4 100644
--- a/test/conformance/testing/include/uur/environment.h
+++ b/test/conformance/testing/include/uur/environment.h
@@ -42,6 +42,9 @@ struct PlatformEnvironment : AdapterEnvironment {
PlatformOptions parsePlatformOptions(int argc, char **argv);
PlatformOptions platform_options;
+ // List of all discovered platforms
+ std::vector all_platforms;
+ // Adapter and platform selected for testing via platform_options
ur_adapter_handle_t adapter = nullptr;
ur_platform_handle_t platform = nullptr;
static PlatformEnvironment *instance;
diff --git a/test/conformance/testing/include/uur/fixtures.h b/test/conformance/testing/include/uur/fixtures.h
index 5435b20a42..42896314cc 100644
--- a/test/conformance/testing/include/uur/fixtures.h
+++ b/test/conformance/testing/include/uur/fixtures.h
@@ -42,7 +42,10 @@ struct urAdapterTest : ::testing::Test,
ur_adapter_handle_t adapter;
};
-struct urPlatformTest : ::testing::Test {
+// Inherit this to get the platform/adapter that was selected via the --backend
+// and --platform arguments (or defaulted to if only one platform was
+// discovered)
+struct urSelectedPlatformTest : ::testing::Test {
void SetUp() override {
platform = uur::PlatformEnvironment::instance->platform;
adapter = uur::PlatformEnvironment::instance->adapter;
@@ -52,6 +55,17 @@ struct urPlatformTest : ::testing::Test {
ur_adapter_handle_t adapter = nullptr;
};
+// In the vein of urAdapterTest and urDeviceTest this is a parameterized
+// platform fixture which can be instantiated via
+// UUR_INSTANTIATE_PLATFORM_TEST_SUITE_P to run tests on each discovered
+// platform.
+struct urPlatformTest : ::testing::Test,
+ ::testing::WithParamInterface {
+ void SetUp() override { platform = GetParam(); }
+
+ ur_platform_handle_t platform = nullptr;
+};
+
inline std::pair>
GetDevices(ur_platform_handle_t platform) {
uint32_t count = 0;
@@ -77,9 +91,9 @@ inline bool hasDevicePartitionSupport(ur_device_handle_t device,
properties.end();
}
-struct urAllDevicesTest : urPlatformTest {
+struct urAllDevicesTest : urSelectedPlatformTest {
void SetUp() override {
- UUR_RETURN_ON_FATAL_FAILURE(urPlatformTest::SetUp());
+ UUR_RETURN_ON_FATAL_FAILURE(urSelectedPlatformTest::SetUp());
auto devicesPair = GetDevices(platform);
if (!devicesPair.first) {
FAIL() << "Failed to get devices";
@@ -91,23 +105,23 @@ struct urAllDevicesTest : urPlatformTest {
for (auto &device : devices) {
EXPECT_SUCCESS(urDeviceRelease(device));
}
- UUR_RETURN_ON_FATAL_FAILURE(urPlatformTest::TearDown());
+ UUR_RETURN_ON_FATAL_FAILURE(urSelectedPlatformTest::TearDown());
}
std::vector devices;
};
-struct urDeviceTest : urPlatformTest,
+struct urDeviceTest : urSelectedPlatformTest,
::testing::WithParamInterface {
void SetUp() override {
- UUR_RETURN_ON_FATAL_FAILURE(urPlatformTest::SetUp());
+ UUR_RETURN_ON_FATAL_FAILURE(urSelectedPlatformTest::SetUp());
device = GetParam();
EXPECT_SUCCESS(urDeviceRetain(device));
}
void TearDown() override {
EXPECT_SUCCESS(urDeviceRelease(device));
- UUR_RETURN_ON_FATAL_FAILURE(urPlatformTest::TearDown());
+ UUR_RETURN_ON_FATAL_FAILURE(urSelectedPlatformTest::SetUp());
}
ur_device_handle_t device;
@@ -122,6 +136,15 @@ struct urDeviceTest : urPlatformTest,
return uur::GetAdapterBackendName(info.param); \
})
+#define UUR_INSTANTIATE_PLATFORM_TEST_SUITE_P(FIXTURE) \
+ INSTANTIATE_TEST_SUITE_P( \
+ , FIXTURE, \
+ ::testing::ValuesIn( \
+ uur::PlatformEnvironment::instance->all_platforms), \
+ [](const ::testing::TestParamInfo &info) { \
+ return uur::GetPlatformNameWithID(info.param); \
+ })
+
#define UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(FIXTURE) \
INSTANTIATE_TEST_SUITE_P( \
, FIXTURE, \
@@ -142,10 +165,10 @@ namespace uur {
template
struct urDeviceTestWithParam
- : urPlatformTest,
+ : urSelectedPlatformTest,
::testing::WithParamInterface> {
void SetUp() override {
- UUR_RETURN_ON_FATAL_FAILURE(urPlatformTest::SetUp());
+ UUR_RETURN_ON_FATAL_FAILURE(urSelectedPlatformTest::SetUp());
device = std::get<0>(this->GetParam());
}
// TODO - I don't like the confusion with GetParam();
@@ -224,9 +247,9 @@ struct urMemImageTest : urContextTest {
if (!imageSupported) {
GTEST_SKIP();
}
- ASSERT_SUCCESS(urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE,
- &image_format, &image_desc, nullptr,
- &image));
+ UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(
+ urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE, &image_format,
+ &image_desc, nullptr, &image));
}
void TearDown() override {
@@ -338,8 +361,9 @@ template struct urMemImageTestWithParam : urContextTestWithParam {
if (!imageSupported) {
GTEST_SKIP();
}
- ASSERT_SUCCESS(urMemImageCreate(this->context, UR_MEM_FLAG_READ_WRITE,
- &format, &desc, nullptr, &image));
+ UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(
+ urMemImageCreate(this->context, UR_MEM_FLAG_READ_WRITE, &format,
+ &desc, nullptr, &image));
ASSERT_NE(nullptr, image);
}
@@ -388,10 +412,6 @@ struct urQueueTest : urContextTest {
struct urHostPipeTest : urQueueTest {
void SetUp() override {
UUR_RETURN_ON_FATAL_FAILURE(urQueueTest::SetUp());
- UUR_RETURN_ON_FATAL_FAILURE(
- uur::KernelsEnvironment::instance->LoadSource("foo", il_binary));
- ASSERT_SUCCESS(uur::KernelsEnvironment::instance->CreateProgram(
- platform, context, device, *il_binary, nullptr, &program));
size_t size = 0;
ASSERT_SUCCESS(urDeviceGetInfo(
@@ -399,6 +419,7 @@ struct urHostPipeTest : urQueueTest {
&size));
ASSERT_NE(size, 0);
ASSERT_EQ(sizeof(ur_bool_t), size);
+
void *info_data = alloca(size);
ASSERT_SUCCESS(urDeviceGetInfo(
device, UR_DEVICE_INFO_HOST_PIPE_READ_WRITE_SUPPORTED, size,
@@ -410,6 +431,11 @@ struct urHostPipeTest : urQueueTest {
if (!supported) {
GTEST_SKIP() << "Host pipe read/write is not supported.";
}
+
+ UUR_RETURN_ON_FATAL_FAILURE(
+ uur::KernelsEnvironment::instance->LoadSource("foo", il_binary));
+ ASSERT_SUCCESS(uur::KernelsEnvironment::instance->CreateProgram(
+ platform, context, device, *il_binary, nullptr, &program));
}
void TearDown() override {
@@ -558,9 +584,9 @@ struct urMultiQueueTestWithParam : urContextTestWithParam {
};
template
-struct urMultiDeviceContextTestTemplate : urPlatformTest {
+struct urMultiDeviceContextTestTemplate : urSelectedPlatformTest {
void SetUp() override {
- UUR_RETURN_ON_FATAL_FAILURE(urPlatformTest::SetUp());
+ UUR_RETURN_ON_FATAL_FAILURE(urSelectedPlatformTest::SetUp());
auto &devices = DevicesEnvironment::instance->devices;
if (devices.size() < MinDevices) {
GTEST_SKIP();
@@ -573,7 +599,7 @@ struct urMultiDeviceContextTestTemplate : urPlatformTest {
if (context) {
ASSERT_SUCCESS(urContextRelease(context));
}
- UUR_RETURN_ON_FATAL_FAILURE(urPlatformTest::TearDown());
+ UUR_RETURN_ON_FATAL_FAILURE(urSelectedPlatformTest::TearDown());
}
ur_context_handle_t context = nullptr;
diff --git a/test/conformance/testing/include/uur/utils.h b/test/conformance/testing/include/uur/utils.h
index 2415e580c5..76b0cfe31d 100644
--- a/test/conformance/testing/include/uur/utils.h
+++ b/test/conformance/testing/include/uur/utils.h
@@ -190,6 +190,15 @@ inline std::string GetPlatformName(ur_platform_handle_t hPlatform) {
std::string(platform_name.data(), platform_name.size()));
}
+inline std::string GetPlatformNameWithID(ur_platform_handle_t hPlatform) {
+ auto platform_name = GetPlatformName(hPlatform);
+ auto &platforms = uur::PlatformEnvironment::instance->all_platforms;
+ size_t platform_id =
+ std::find(platforms.begin(), platforms.end(), hPlatform) -
+ platforms.begin();
+ return platform_name + "_ID" + std::to_string(platform_id);
+}
+
inline std::string GetDeviceName(ur_device_handle_t device) {
std::string device_name, device_uuid;
GetDeviceInfo(device, UR_DEVICE_INFO_NAME, device_name);