mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Change Behaviour of C11 Atomic Tests for OpenCL-3.0 (#944)
* Change setup code in `KernelCode()` to use `_explicit` builtin variants that are common to both OpenCL-2.X and OpenCL-3.0. * Only test optional supported builtin variants (`_explicit` signature memory_order/scope) for OpenCL-3.0. * Disable program scope global variable and generic address space tests for a OpenCL-3.0 driver which does not optionally support these features.
This commit is contained in:
@@ -206,6 +206,7 @@ public:
|
||||
using CBasicTestMemOrderScope<HostAtomicType, HostDataType>::MemoryOrder;
|
||||
using CBasicTestMemOrderScope<HostAtomicType, HostDataType>::MemoryScope;
|
||||
using CBasicTestMemOrderScope<HostAtomicType, HostDataType>::MemoryOrderScopeStr;
|
||||
using CBasicTestMemOrderScope<HostAtomicType, HostDataType>::MemoryScopeStr;
|
||||
using CBasicTest<HostAtomicType, HostDataType>::CheckCapabilities;
|
||||
CBasicTestLoad(TExplicitAtomicType dataType, bool useSVM) : CBasicTestMemOrderScope<HostAtomicType, HostDataType>(dataType, useSVM)
|
||||
{
|
||||
@@ -228,11 +229,19 @@ public:
|
||||
}
|
||||
virtual std::string ProgramCore()
|
||||
{
|
||||
std::string memoryOrderScope = MemoryOrderScopeStr();
|
||||
std::string postfix(memoryOrderScope.empty() ? "" : "_explicit");
|
||||
return
|
||||
" atomic_store(&destMemory[tid], tid);\n"
|
||||
" oldValues[tid] = atomic_load"+postfix+"(&destMemory[tid]"+memoryOrderScope+");\n";
|
||||
// In the case this test is run with MEMORY_ORDER_ACQUIRE, the store
|
||||
// should be MEMORY_ORDER_RELEASE
|
||||
std::string memoryOrderScopeLoad = MemoryOrderScopeStr();
|
||||
std::string memoryOrderScopeStore =
|
||||
(MemoryOrder() == MEMORY_ORDER_ACQUIRE)
|
||||
? (", memory_order_release" + MemoryScopeStr())
|
||||
: memoryOrderScopeLoad;
|
||||
std::string postfix(memoryOrderScopeLoad.empty() ? "" : "_explicit");
|
||||
return " atomic_store" + postfix + "(&destMemory[tid], tid"
|
||||
+ memoryOrderScopeStore
|
||||
+ ");\n"
|
||||
" oldValues[tid] = atomic_load"
|
||||
+ postfix + "(&destMemory[tid]" + memoryOrderScopeLoad + ");\n";
|
||||
}
|
||||
virtual void HostFunction(cl_uint tid, cl_uint threadCount, volatile HostAtomicType *destMemory, HostDataType *oldValues)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user