P4 to Git Change 1398097 by lmoriche@lmoriche_opencl_dev2 on 2017/04/13 13:01:56
SWDEV-102733 - [OCL-LC-ROCm] Cmake build Write CMakeLists.txt to enable building with and without the DK environment - Change the coding convention of the runtime files. Use Google's Style (https://google.github.io/styleguide/cppguide.html). Affected files ... ... //depot/stg/opencl/drivers/opencl/.clang-format#1 add ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_agent_amd.h#2 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_command.cpp#13 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_context.cpp#53 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_counter.cpp#2 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_d3d10.cpp#15 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_d3d11.cpp#22 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_d3d9.cpp#32 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_debugger_amd.cpp#8 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_debugger_amd.h#7 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_device.cpp#61 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_event.cpp#10 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_execute.cpp#23 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_gl.cpp#53 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_icd.cpp#27 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_icd_amd.h#18 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_kernel.h#24 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_kernel_info_amd.cpp#3 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_kernel_info_amd.h#4 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_lqdflash_amd.cpp#17 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_lqdflash_amd.h#6 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_memobj.cpp#81 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_object.cpp#3 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_pipe.cpp#6 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_platform_amd.cpp#2 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_platform_amd.h#2 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_profile_amd.cpp#3 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_profile_amd.h#2 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_program.cpp#41 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_sampler.cpp#6 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_sdi_amd.cpp#3 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_sdi_amd.h#2 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_semaphore_amd.h#3 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_svm.cpp#20 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_thread_trace_amd.cpp#8 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_thread_trace_amd.h#4 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/appprofile.cpp#17 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/appprofile.hpp#12 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/blit.cpp#4 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/blit.hpp#4 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/blitcl.cpp#11 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpubinary.cpp#11 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpubinary.hpp#4 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpubuiltins.cpp#13 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpubuiltins.hpp#4 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpucommand.cpp#66 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpucommand.hpp#40 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpudevice.cpp#280 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpudevice.hpp#96 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpufeat.hpp#3 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpukernel.hpp#8 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpumapping.cpp#6 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpumapping.hpp#4 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpuprogram.cpp#70 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpuprogram.hpp#14 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpusettings.cpp#33 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpusettings.hpp#2 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cputables.hpp#5 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpuvirtual.cpp#26 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpuvirtual.hpp#13 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#209 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#284 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuappprofile.cpp#12 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuappprofile.hpp#7 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpubinary.cpp#58 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpubinary.hpp#27 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpublit.cpp#126 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpublit.hpp#41 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpucompiler.cpp#156 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuconstbuf.cpp#10 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuconstbuf.hpp#7 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpucounters.cpp#12 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpucounters.hpp#9 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudebugger.hpp#7 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudebugmanager.cpp#10 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudebugmanager.hpp#6 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudefs.hpp#147 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#567 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.hpp#163 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.cpp#318 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.hpp#126 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpumemory.cpp#131 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpumemory.hpp#50 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprintf.cpp#44 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprintf.hpp#15 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.cpp#232 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.hpp#69 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuresource.cpp#238 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuresource.hpp#87 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpusched.hpp#19 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuschedcl.cpp#35 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuscsi.cpp#37 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpusettings.cpp#350 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpusettings.hpp#98 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gputhreadtrace.cpp#9 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gputhreadtrace.hpp#7 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gputimestamp.cpp#27 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gputimestamp.hpp#16 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gputrap.hpp#4 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.cpp#410 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.hpp#140 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuwavelimiter.cpp#13 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuwavelimiter.hpp#9 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hwdebug.cpp#7 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hwdebug.hpp#8 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palappprofile.cpp#2 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palappprofile.hpp#3 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palbinary.cpp#2 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palbinary.hpp#3 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palblit.cpp#13 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palblit.hpp#5 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palcompiler.cpp#15 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palconstbuf.cpp#2 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palconstbuf.hpp#3 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palcounters.cpp#11 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palcounters.hpp#9 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldebugger.hpp#3 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldebugmanager.cpp#2 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldebugmanager.hpp#3 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldefs.hpp#16 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#45 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.hpp#16 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldeviced3d10.cpp#2 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldeviced3d11.cpp#2 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldeviced3d9.cpp#2 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevicegl.cpp#4 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palkernel.cpp#34 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palkernel.hpp#11 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palmemory.cpp#13 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palmemory.hpp#3 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprintf.cpp#5 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprintf.hpp#3 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprogram.cpp#39 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprogram.hpp#17 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palresource.cpp#28 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palresource.hpp#12 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palsched.hpp#3 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palschedcl.cpp#4 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palsettings.cpp#24 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palsettings.hpp#10 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palthreadtrace.cpp#3 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palthreadtrace.hpp#5 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paltimestamp.cpp#2 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paltimestamp.hpp#3 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paltrap.hpp#2 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palvirtual.cpp#48 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palvirtual.hpp#21 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palwavelimiter.cpp#3 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palwavelimiter.hpp#4 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/mesa_glinterop.h#4 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocappprofile.cpp#6 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocappprofile.hpp#4 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocbinary.hpp#4 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocblit.cpp#17 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocblit.hpp#8 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roccompiler.cpp#32 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roccompilerlib.cpp#6 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roccompilerlib.hpp#5 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdefs.hpp#10 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#48 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.hpp#20 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocglinterop.cpp#4 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocglinterop.hpp#4 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.cpp#22 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.hpp#16 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocmemory.cpp#15 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocmemory.hpp#8 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprintf.cpp#7 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprintf.hpp#5 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.cpp#64 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.hpp#23 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocregisters.hpp#4 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocsettings.cpp#17 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocsettings.hpp#8 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.cpp#34 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.hpp#10 edit ... //depot/stg/opencl/drivers/opencl/runtime/os/alloc.cpp#7 edit ... //depot/stg/opencl/drivers/opencl/runtime/os/alloc.hpp#4 edit ... //depot/stg/opencl/drivers/opencl/runtime/os/os.cpp#8 edit ... //depot/stg/opencl/drivers/opencl/runtime/os/os.hpp#30 edit ... //depot/stg/opencl/drivers/opencl/runtime/os/os_posix.cpp#42 edit ... //depot/stg/opencl/drivers/opencl/runtime/os/os_win32.cpp#47 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/agent.cpp#8 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/agent.hpp#6 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/command.cpp#78 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/command.hpp#83 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/commandqueue.cpp#23 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/commandqueue.hpp#18 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/context.cpp#42 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/context.hpp#26 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/counter.hpp#4 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/interop.hpp#12 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/kernel.cpp#23 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/kernel.hpp#18 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/memory.cpp#127 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/memory.hpp#100 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/ndrange.cpp#8 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/ndrange.hpp#9 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/object.cpp#2 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/object.hpp#17 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/perfctr.hpp#5 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/program.cpp#86 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/program.hpp#41 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/runtime.cpp#35 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/runtime.hpp#4 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/sampler.hpp#8 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/threadtrace.hpp#6 edit ... //depot/stg/opencl/drivers/opencl/runtime/thread/atomic.hpp#7 edit ... //depot/stg/opencl/drivers/opencl/runtime/thread/monitor.cpp#7 edit ... //depot/stg/opencl/drivers/opencl/runtime/thread/monitor.hpp#8 edit ... //depot/stg/opencl/drivers/opencl/runtime/thread/semaphore.cpp#10 edit ... //depot/stg/opencl/drivers/opencl/runtime/thread/semaphore.hpp#7 edit ... //depot/stg/opencl/drivers/opencl/runtime/thread/thread.cpp#14 edit ... //depot/stg/opencl/drivers/opencl/runtime/thread/thread.hpp#15 edit ... //depot/stg/opencl/drivers/opencl/runtime/top.hpp#26 edit ... //depot/stg/opencl/drivers/opencl/runtime/utils/concurrent.hpp#8 edit ... //depot/stg/opencl/drivers/opencl/runtime/utils/debug.cpp#5 edit ... //depot/stg/opencl/drivers/opencl/runtime/utils/debug.hpp#7 edit ... //depot/stg/opencl/drivers/opencl/runtime/utils/flags.cpp#16 edit ... //depot/stg/opencl/drivers/opencl/runtime/utils/flags.hpp#271 edit ... //depot/stg/opencl/drivers/opencl/runtime/utils/macros.hpp#8 edit ... //depot/stg/opencl/drivers/opencl/runtime/utils/util.hpp#12 edit ... //depot/stg/opencl/drivers/opencl/runtime/utils/versions.hpp#2150 edit
This commit is contained in:
@@ -0,0 +1,10 @@
|
|||||||
|
Language: Cpp
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AlignEscapedNewlinesLeft: false
|
||||||
|
AlignOperands: false
|
||||||
|
ColumnLimit: 100
|
||||||
|
AlwaysBreakTemplateDeclarations: false
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
IndentFunctionDeclarationAfterType: false
|
||||||
|
MaxEmptyLinesToKeep: 2
|
||||||
|
SortIncludes: false
|
||||||
@@ -107,203 +107,149 @@ typedef const struct _cl_agent cl_agent;
|
|||||||
|
|
||||||
/* Context Callbacks */
|
/* Context Callbacks */
|
||||||
|
|
||||||
typedef void (CL_CALLBACK * acContextCreate_fn)(
|
typedef void(CL_CALLBACK* acContextCreate_fn)(cl_agent* /* agent */, cl_context /* context */);
|
||||||
cl_agent * /* agent */,
|
|
||||||
cl_context /* context */);
|
|
||||||
|
|
||||||
typedef void (CL_CALLBACK * acContextFree_fn)(
|
typedef void(CL_CALLBACK* acContextFree_fn)(cl_agent* /* agent */, cl_context /* context */);
|
||||||
cl_agent * /* agent */,
|
|
||||||
cl_context /* context */);
|
|
||||||
|
|
||||||
/* Command Queue Callbacks */
|
/* Command Queue Callbacks */
|
||||||
|
|
||||||
typedef void (CL_CALLBACK * acCommandQueueCreate_fn)(
|
typedef void(CL_CALLBACK* acCommandQueueCreate_fn)(cl_agent* /* agent */,
|
||||||
cl_agent * /* agent */,
|
cl_command_queue /* queue */);
|
||||||
cl_command_queue /* queue */);
|
|
||||||
|
|
||||||
typedef void (CL_CALLBACK * acCommandQueueFree_fn)(
|
typedef void(CL_CALLBACK* acCommandQueueFree_fn)(cl_agent* /* agent */,
|
||||||
cl_agent * /* agent */,
|
cl_command_queue /* queue */);
|
||||||
cl_command_queue /* queue */);
|
|
||||||
|
|
||||||
/* Event Callbacks */
|
/* Event Callbacks */
|
||||||
|
|
||||||
typedef void (CL_CALLBACK * acEventCreate_fn)(
|
typedef void(CL_CALLBACK* acEventCreate_fn)(cl_agent* /* agent */, cl_event /* event */,
|
||||||
cl_agent * /* agent */,
|
cl_command_type /* type */);
|
||||||
cl_event /* event */,
|
|
||||||
cl_command_type /* type */);
|
|
||||||
|
|
||||||
typedef void (CL_CALLBACK * acEventFree_fn)(
|
typedef void(CL_CALLBACK* acEventFree_fn)(cl_agent* /* agent */, cl_event /* event */);
|
||||||
cl_agent * /* agent */,
|
|
||||||
cl_event /* event */);
|
|
||||||
|
|
||||||
typedef void (CL_CALLBACK * acEventStatusChanged_fn)(
|
typedef void(CL_CALLBACK* acEventStatusChanged_fn)(cl_agent* /* agent */, cl_event /* event */,
|
||||||
cl_agent * /* agent */,
|
cl_int /* execution_status */,
|
||||||
cl_event /* event */,
|
cl_long /* epoch_time_stamp */);
|
||||||
cl_int /* execution_status */,
|
|
||||||
cl_long /* epoch_time_stamp */);
|
|
||||||
|
|
||||||
/* Memory Object Callbacks */
|
/* Memory Object Callbacks */
|
||||||
|
|
||||||
typedef void (CL_CALLBACK * acMemObjectCreate_fn)(
|
typedef void(CL_CALLBACK* acMemObjectCreate_fn)(cl_agent* /* agent */, cl_mem /* memobj */);
|
||||||
cl_agent * /* agent */,
|
|
||||||
cl_mem /* memobj */);
|
|
||||||
|
|
||||||
typedef void (CL_CALLBACK * acMemObjectFree_fn)(
|
typedef void(CL_CALLBACK* acMemObjectFree_fn)(cl_agent* /* agent */, cl_mem /* memobj */);
|
||||||
cl_agent * /* agent */,
|
|
||||||
cl_mem /* memobj */);
|
|
||||||
|
|
||||||
typedef void (CL_CALLBACK * acMemObjectAcquired_fn)(
|
typedef void(CL_CALLBACK* acMemObjectAcquired_fn)(cl_agent* /* agent */, cl_mem /* memobj */,
|
||||||
cl_agent * /* agent */,
|
cl_device_id /* device */,
|
||||||
cl_mem /* memobj */,
|
cl_long /* elapsed_time */);
|
||||||
cl_device_id /* device */,
|
|
||||||
cl_long /* elapsed_time */);
|
|
||||||
|
|
||||||
/* Sampler Callbacks */
|
/* Sampler Callbacks */
|
||||||
|
|
||||||
typedef void (CL_CALLBACK * acSamplerCreate_fn)(
|
typedef void(CL_CALLBACK* acSamplerCreate_fn)(cl_agent* /* agent */, cl_sampler /* sampler */);
|
||||||
cl_agent * /* agent */,
|
|
||||||
cl_sampler /* sampler */);
|
|
||||||
|
|
||||||
typedef void (CL_CALLBACK * acSamplerFree_fn)(
|
typedef void(CL_CALLBACK* acSamplerFree_fn)(cl_agent* /* agent */, cl_sampler /* sampler */);
|
||||||
cl_agent * /* agent */,
|
|
||||||
cl_sampler /* sampler */);
|
|
||||||
|
|
||||||
/* Program Callbacks */
|
/* Program Callbacks */
|
||||||
|
|
||||||
typedef void (CL_CALLBACK * acProgramCreate_fn)(
|
typedef void(CL_CALLBACK* acProgramCreate_fn)(cl_agent* /* agent */, cl_program /* program */);
|
||||||
cl_agent * /* agent */,
|
|
||||||
cl_program /* program */);
|
|
||||||
|
|
||||||
typedef void (CL_CALLBACK * acProgramFree_fn)(
|
typedef void(CL_CALLBACK* acProgramFree_fn)(cl_agent* /* agent */, cl_program /* program */);
|
||||||
cl_agent * /* agent */,
|
|
||||||
cl_program /* program */);
|
|
||||||
|
|
||||||
typedef void (CL_CALLBACK * acProgramBuild_fn)(
|
typedef void(CL_CALLBACK* acProgramBuild_fn)(cl_agent* /* agent */, cl_program /* program */);
|
||||||
cl_agent * /* agent */,
|
|
||||||
cl_program /* program */);
|
|
||||||
|
|
||||||
/* Kernel Callbacks */
|
/* Kernel Callbacks */
|
||||||
|
|
||||||
typedef void (CL_CALLBACK * acKernelCreate_fn)(
|
typedef void(CL_CALLBACK* acKernelCreate_fn)(cl_agent* /* agent */, cl_kernel /* kernel */);
|
||||||
cl_agent * /* agent */,
|
|
||||||
cl_kernel /* kernel */);
|
|
||||||
|
|
||||||
typedef void (CL_CALLBACK * acKernelFree_fn)(
|
typedef void(CL_CALLBACK* acKernelFree_fn)(cl_agent* /* agent */, cl_kernel /* kernel */);
|
||||||
cl_agent * /* agent */,
|
|
||||||
cl_kernel /* kernel */);
|
|
||||||
|
|
||||||
typedef void (CL_CALLBACK * acKernelSetArg_fn)(
|
typedef void(CL_CALLBACK* acKernelSetArg_fn)(cl_agent* /* agent */, cl_kernel /* kernel */,
|
||||||
cl_agent * /* agent */,
|
cl_int /* arg_index */, size_t /* size */,
|
||||||
cl_kernel /* kernel */,
|
const void* /* value_ptr */);
|
||||||
cl_int /* arg_index */,
|
|
||||||
size_t /* size */,
|
|
||||||
const void * /* value_ptr */);
|
|
||||||
|
|
||||||
typedef struct _cl_agent_callbacks
|
typedef struct _cl_agent_callbacks {
|
||||||
{
|
/* Context Callbacks */
|
||||||
/* Context Callbacks */
|
acContextCreate_fn ContextCreate;
|
||||||
acContextCreate_fn ContextCreate;
|
acContextFree_fn ContextFree;
|
||||||
acContextFree_fn ContextFree;
|
|
||||||
|
|
||||||
/* Command Queue Callbacks */
|
/* Command Queue Callbacks */
|
||||||
acCommandQueueCreate_fn CommandQueueCreate;
|
acCommandQueueCreate_fn CommandQueueCreate;
|
||||||
acCommandQueueFree_fn CommandQueueFree;
|
acCommandQueueFree_fn CommandQueueFree;
|
||||||
|
|
||||||
/* Event Callbacks */
|
/* Event Callbacks */
|
||||||
acEventCreate_fn EventCreate;
|
acEventCreate_fn EventCreate;
|
||||||
acEventFree_fn EventFree;
|
acEventFree_fn EventFree;
|
||||||
acEventStatusChanged_fn EventStatusChanged;
|
acEventStatusChanged_fn EventStatusChanged;
|
||||||
|
|
||||||
/* Memory Object Callbacks */
|
/* Memory Object Callbacks */
|
||||||
acMemObjectCreate_fn MemObjectCreate;
|
acMemObjectCreate_fn MemObjectCreate;
|
||||||
acMemObjectFree_fn MemObjectFree;
|
acMemObjectFree_fn MemObjectFree;
|
||||||
acMemObjectAcquired_fn MemObjectAcquired;
|
acMemObjectAcquired_fn MemObjectAcquired;
|
||||||
|
|
||||||
/* Sampler Callbacks */
|
/* Sampler Callbacks */
|
||||||
acSamplerCreate_fn SamplerCreate;
|
acSamplerCreate_fn SamplerCreate;
|
||||||
acSamplerFree_fn SamplerFree;
|
acSamplerFree_fn SamplerFree;
|
||||||
|
|
||||||
/* Program Callbacks */
|
/* Program Callbacks */
|
||||||
acProgramCreate_fn ProgramCreate;
|
acProgramCreate_fn ProgramCreate;
|
||||||
acProgramFree_fn ProgramFree;
|
acProgramFree_fn ProgramFree;
|
||||||
acProgramBuild_fn ProgramBuild;
|
acProgramBuild_fn ProgramBuild;
|
||||||
|
|
||||||
/* Kernel Callbacks */
|
/* Kernel Callbacks */
|
||||||
acKernelCreate_fn KernelCreate;
|
acKernelCreate_fn KernelCreate;
|
||||||
acKernelFree_fn KernelFree;
|
acKernelFree_fn KernelFree;
|
||||||
acKernelSetArg_fn KernelSetArg;
|
acKernelSetArg_fn KernelSetArg;
|
||||||
|
|
||||||
} cl_agent_callbacks;
|
} cl_agent_callbacks;
|
||||||
|
|
||||||
typedef cl_uint cl_agent_capability_action;
|
typedef cl_uint cl_agent_capability_action;
|
||||||
|
|
||||||
#define CL_AGENT_ADD_CAPABILITIES 0x0
|
#define CL_AGENT_ADD_CAPABILITIES 0x0
|
||||||
#define CL_AGENT_RELINQUISH_CAPABILITIES 0x1
|
#define CL_AGENT_RELINQUISH_CAPABILITIES 0x1
|
||||||
|
|
||||||
typedef struct _cl_agent_capabilities
|
typedef struct _cl_agent_capabilities {
|
||||||
{
|
cl_bitfield canGenerateContextEvents : 1;
|
||||||
cl_bitfield canGenerateContextEvents : 1;
|
cl_bitfield canGenerateCommandQueueEvents : 1;
|
||||||
cl_bitfield canGenerateCommandQueueEvents : 1;
|
cl_bitfield canGenerateEventEvents : 1;
|
||||||
cl_bitfield canGenerateEventEvents : 1;
|
cl_bitfield canGenerateMemObjectEvents : 1;
|
||||||
cl_bitfield canGenerateMemObjectEvents : 1;
|
cl_bitfield canGenerateSamplerEvents : 1;
|
||||||
cl_bitfield canGenerateSamplerEvents : 1;
|
cl_bitfield canGenerateProgramEvents : 1;
|
||||||
cl_bitfield canGenerateProgramEvents : 1;
|
cl_bitfield canGenerateKernelEvents : 1;
|
||||||
cl_bitfield canGenerateKernelEvents : 1;
|
|
||||||
|
|
||||||
} cl_agent_capabilities;
|
} cl_agent_capabilities;
|
||||||
|
|
||||||
struct _cl_agent
|
struct _cl_agent {
|
||||||
{
|
cl_int(CL_API_CALL* GetVersionNumber)(cl_agent* /* agent */, cl_int* /* version_ret */);
|
||||||
cl_int (CL_API_CALL * GetVersionNumber)(
|
|
||||||
cl_agent * /* agent */,
|
|
||||||
cl_int * /* version_ret */);
|
|
||||||
|
|
||||||
cl_int (CL_API_CALL * GetPlatform)(
|
cl_int(CL_API_CALL* GetPlatform)(cl_agent* /* agent */, cl_platform_id* /* platform_id_ret */);
|
||||||
cl_agent * /* agent */,
|
|
||||||
cl_platform_id * /* platform_id_ret */);
|
|
||||||
|
|
||||||
cl_int (CL_API_CALL * GetTime) (
|
cl_int(CL_API_CALL* GetTime)(cl_agent* /* agent */, cl_long* /* time_nanos */);
|
||||||
cl_agent * /* agent */,
|
|
||||||
cl_long * /* time_nanos */);
|
|
||||||
|
|
||||||
cl_int (CL_API_CALL * SetCallbacks)(
|
cl_int(CL_API_CALL* SetCallbacks)(cl_agent* /* agent */,
|
||||||
cl_agent * /* agent */,
|
const cl_agent_callbacks* /* callbacks */, size_t /* size */);
|
||||||
const cl_agent_callbacks * /* callbacks */,
|
|
||||||
size_t /* size */);
|
|
||||||
|
|
||||||
|
|
||||||
cl_int (CL_API_CALL * GetPotentialCapabilities)(
|
cl_int(CL_API_CALL* GetPotentialCapabilities)(cl_agent* /* agent */,
|
||||||
cl_agent * /* agent */,
|
cl_agent_capabilities* /* capabilities */);
|
||||||
cl_agent_capabilities * /* capabilities */);
|
|
||||||
|
|
||||||
cl_int (CL_API_CALL * GetCapabilities)(
|
cl_int(CL_API_CALL* GetCapabilities)(cl_agent* /* agent */,
|
||||||
cl_agent * /* agent */,
|
cl_agent_capabilities* /* capabilities */);
|
||||||
cl_agent_capabilities * /* capabilities */);
|
|
||||||
|
|
||||||
cl_int (CL_API_CALL * SetCapabilities)(
|
cl_int(CL_API_CALL* SetCapabilities)(cl_agent* /* agent */,
|
||||||
cl_agent * /* agent */,
|
const cl_agent_capabilities* /* capabilities */,
|
||||||
const cl_agent_capabilities * /* capabilities */,
|
cl_agent_capability_action /* action */);
|
||||||
cl_agent_capability_action /* action */);
|
|
||||||
|
|
||||||
|
|
||||||
cl_int (CL_API_CALL * GetICDDispatchTable)(
|
cl_int(CL_API_CALL* GetICDDispatchTable)(cl_agent* /* agent */,
|
||||||
cl_agent * /* agent */,
|
cl_icd_dispatch_table* /* table */, size_t /* size */);
|
||||||
cl_icd_dispatch_table * /* table */,
|
|
||||||
size_t /* size */);
|
|
||||||
|
|
||||||
cl_int (CL_API_CALL * SetICDDispatchTable)(
|
cl_int(CL_API_CALL* SetICDDispatchTable)(cl_agent* /* agent */,
|
||||||
cl_agent * /* agent */,
|
const cl_icd_dispatch_table* /* table */,
|
||||||
const cl_icd_dispatch_table * /* table */,
|
size_t /* size */);
|
||||||
size_t /* size */);
|
|
||||||
|
|
||||||
/* add Kernel/Program helper functions, etc... */
|
/* add Kernel/Program helper functions, etc... */
|
||||||
};
|
};
|
||||||
|
|
||||||
extern cl_int CL_CALLBACK
|
extern cl_int CL_CALLBACK clAgent_OnLoad(cl_agent* /* agent */);
|
||||||
clAgent_OnLoad(cl_agent * /* agent */);
|
|
||||||
|
|
||||||
extern void CL_CALLBACK
|
extern void CL_CALLBACK clAgent_OnUnload(cl_agent* /* agent */);
|
||||||
clAgent_OnUnload(cl_agent * /* agent */);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,132 +54,122 @@
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY_RET(cl_command_queue, clCreateCommandQueueWithProperties, (
|
RUNTIME_ENTRY_RET(cl_command_queue, clCreateCommandQueueWithProperties,
|
||||||
cl_context context,
|
(cl_context context, cl_device_id device,
|
||||||
cl_device_id device,
|
const cl_queue_properties* queue_properties, cl_int* errcode_ret)) {
|
||||||
const cl_queue_properties *queue_properties,
|
if (!is_valid(context)) {
|
||||||
cl_int *errcode_ret))
|
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
|
||||||
{
|
return (cl_command_queue)0;
|
||||||
if (!is_valid(context)) {
|
}
|
||||||
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
|
|
||||||
return (cl_command_queue) 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::Context& amdContext = *as_amd(context);
|
amd::Context& amdContext = *as_amd(context);
|
||||||
amd::Device& amdDevice = *as_amd(device);
|
amd::Device& amdDevice = *as_amd(device);
|
||||||
|
|
||||||
if (!is_valid(device) ||
|
if (!is_valid(device) || !amdContext.containsDevice(&amdDevice)) {
|
||||||
!amdContext.containsDevice(&amdDevice)) {
|
*not_null(errcode_ret) = CL_INVALID_DEVICE;
|
||||||
*not_null(errcode_ret) = CL_INVALID_DEVICE;
|
return (cl_command_queue)0;
|
||||||
return (cl_command_queue) 0;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
cl_command_queue_properties properties = 0;
|
cl_command_queue_properties properties = 0;
|
||||||
const struct QueueProperty {
|
const struct QueueProperty {
|
||||||
cl_queue_properties name;
|
cl_queue_properties name;
|
||||||
union {
|
union {
|
||||||
cl_queue_properties raw;
|
cl_queue_properties raw;
|
||||||
//FIXME_lmoriche: Check with Khronos. cl_queue_properties is an intptr,
|
// FIXME_lmoriche: Check with Khronos. cl_queue_properties is an intptr,
|
||||||
//but cl_command_queue_properties is a bitfield (truncate?).
|
// but cl_command_queue_properties is a bitfield (truncate?).
|
||||||
//cl_command_queue_properties properties;
|
// cl_command_queue_properties properties;
|
||||||
cl_uint size;
|
cl_uint size;
|
||||||
} value;
|
} value;
|
||||||
} *p = reinterpret_cast<const QueueProperty*>(queue_properties);
|
}* p = reinterpret_cast<const QueueProperty*>(queue_properties);
|
||||||
|
|
||||||
uint queueSize = amdDevice.info().queueOnDevicePreferredSize_;
|
uint queueSize = amdDevice.info().queueOnDevicePreferredSize_;
|
||||||
uint queueRTCUs = amd::CommandQueue::RealTimeDisabled;
|
uint queueRTCUs = amd::CommandQueue::RealTimeDisabled;
|
||||||
amd::CommandQueue::Priority priority = amd::CommandQueue::Priority::Normal;
|
amd::CommandQueue::Priority priority = amd::CommandQueue::Priority::Normal;
|
||||||
if (p != NULL) while(p->name != 0) {
|
if (p != NULL)
|
||||||
switch(p->name) {
|
while (p->name != 0) {
|
||||||
|
switch (p->name) {
|
||||||
case CL_QUEUE_PROPERTIES:
|
case CL_QUEUE_PROPERTIES:
|
||||||
//FIXME_lmoriche: See comment above.
|
// FIXME_lmoriche: See comment above.
|
||||||
//properties = p->value.properties;
|
// properties = p->value.properties;
|
||||||
properties = static_cast<cl_command_queue_properties>(p->value.raw);
|
properties = static_cast<cl_command_queue_properties>(p->value.raw);
|
||||||
break;
|
break;
|
||||||
case CL_QUEUE_SIZE:
|
case CL_QUEUE_SIZE:
|
||||||
queueSize = p->value.size;
|
queueSize = p->value.size;
|
||||||
break;
|
break;
|
||||||
#define CL_QUEUE_REAL_TIME_COMPUTE_UNITS_AMD 0x404f
|
#define CL_QUEUE_REAL_TIME_COMPUTE_UNITS_AMD 0x404f
|
||||||
case CL_QUEUE_REAL_TIME_COMPUTE_UNITS_AMD:
|
case CL_QUEUE_REAL_TIME_COMPUTE_UNITS_AMD:
|
||||||
queueRTCUs = p->value.size;
|
queueRTCUs = p->value.size;
|
||||||
break;
|
break;
|
||||||
#define CL_QUEUE_MEDIUM_PRIORITY_AMD 0x4050
|
#define CL_QUEUE_MEDIUM_PRIORITY_AMD 0x4050
|
||||||
case CL_QUEUE_MEDIUM_PRIORITY_AMD:
|
case CL_QUEUE_MEDIUM_PRIORITY_AMD:
|
||||||
priority = amd::CommandQueue::Priority::Medium;
|
priority = amd::CommandQueue::Priority::Medium;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
*not_null(errcode_ret) = CL_INVALID_QUEUE_PROPERTIES;
|
*not_null(errcode_ret) = CL_INVALID_QUEUE_PROPERTIES;
|
||||||
LogWarning("invalid property name");
|
LogWarning("invalid property name");
|
||||||
return (cl_command_queue) 0;
|
return (cl_command_queue)0;
|
||||||
|
}
|
||||||
|
++p;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (queueSize > amdDevice.info().queueOnDeviceMaxSize_) {
|
||||||
|
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||||
|
return (cl_command_queue)0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((queueRTCUs != amd::CommandQueue::RealTimeDisabled) &&
|
||||||
|
((queueRTCUs > amdDevice.info().numRTCUs_) || (queueRTCUs == 0))) {
|
||||||
|
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||||
|
return (cl_command_queue)0;
|
||||||
|
}
|
||||||
|
|
||||||
|
amd::CommandQueue* queue = NULL;
|
||||||
|
{
|
||||||
|
amd::ScopedLock lock(amdContext.lock());
|
||||||
|
|
||||||
|
// Check if the app creates a host queue
|
||||||
|
if (!(properties & CL_QUEUE_ON_DEVICE)) {
|
||||||
|
queue = new amd::HostQueue(amdContext, amdDevice, properties, queueRTCUs, priority);
|
||||||
|
} else {
|
||||||
|
// Is it a device default queue
|
||||||
|
if (properties & CL_QUEUE_ON_DEVICE_DEFAULT) {
|
||||||
|
queue = amdContext.defDeviceQueue(amdDevice);
|
||||||
|
// If current context has one already then return it
|
||||||
|
if (NULL != queue) {
|
||||||
|
queue->retain();
|
||||||
|
*not_null(errcode_ret) = CL_SUCCESS;
|
||||||
|
return as_cl(queue);
|
||||||
}
|
}
|
||||||
++p;
|
}
|
||||||
|
// Check if runtime can allocate a new device queue on this context
|
||||||
|
if (amdContext.isDevQueuePossible(amdDevice)) {
|
||||||
|
queue = new amd::DeviceQueue(amdContext, amdDevice, properties, queueSize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (queueSize > amdDevice.info().queueOnDeviceMaxSize_) {
|
if (queue == NULL || !queue->create()) {
|
||||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
|
||||||
return (cl_command_queue) 0;
|
delete queue;
|
||||||
|
return (cl_command_queue)0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((queueRTCUs != amd::CommandQueue::RealTimeDisabled) &&
|
if (amd::Agent::shouldPostCommandQueueEvents()) {
|
||||||
((queueRTCUs > amdDevice.info().numRTCUs_) || (queueRTCUs == 0))) {
|
amd::Agent::postCommandQueueCreate(as_cl(queue->asCommandQueue()));
|
||||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
}
|
||||||
return (cl_command_queue) 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::CommandQueue* queue = NULL;
|
*not_null(errcode_ret) = CL_SUCCESS;
|
||||||
{
|
return as_cl(queue);
|
||||||
amd::ScopedLock lock(amdContext.lock());
|
|
||||||
|
|
||||||
// Check if the app creates a host queue
|
|
||||||
if (!(properties & CL_QUEUE_ON_DEVICE)) {
|
|
||||||
queue = new amd::HostQueue(amdContext, amdDevice, properties, queueRTCUs, priority);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Is it a device default queue
|
|
||||||
if (properties & CL_QUEUE_ON_DEVICE_DEFAULT) {
|
|
||||||
queue = amdContext.defDeviceQueue(amdDevice);
|
|
||||||
// If current context has one already then return it
|
|
||||||
if (NULL != queue) {
|
|
||||||
queue->retain();
|
|
||||||
*not_null(errcode_ret) = CL_SUCCESS;
|
|
||||||
return as_cl(queue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Check if runtime can allocate a new device queue on this context
|
|
||||||
if (amdContext.isDevQueuePossible(amdDevice)) {
|
|
||||||
queue = new amd::DeviceQueue(
|
|
||||||
amdContext, amdDevice, properties, queueSize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (queue == NULL || !queue->create()) {
|
|
||||||
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
|
|
||||||
delete queue;
|
|
||||||
return (cl_command_queue) 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (amd::Agent::shouldPostCommandQueueEvents()) {
|
|
||||||
amd::Agent::postCommandQueueCreate(as_cl(queue->asCommandQueue()));
|
|
||||||
}
|
|
||||||
|
|
||||||
*not_null(errcode_ret) = CL_SUCCESS;
|
|
||||||
return as_cl(queue);
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
RUNTIME_ENTRY_RET(cl_command_queue, clCreateCommandQueue, (
|
RUNTIME_ENTRY_RET(cl_command_queue, clCreateCommandQueue,
|
||||||
cl_context context,
|
(cl_context context, cl_device_id device, cl_command_queue_properties properties,
|
||||||
cl_device_id device,
|
cl_int* errcode_ret)) {
|
||||||
cl_command_queue_properties properties,
|
const cl_queue_properties cprops[] = {CL_QUEUE_PROPERTIES,
|
||||||
cl_int *errcode_ret))
|
static_cast<cl_queue_properties>(properties), 0};
|
||||||
{
|
return clCreateCommandQueueWithProperties(context, device, properties ? cprops : NULL,
|
||||||
const cl_queue_properties cprops[] = {
|
errcode_ret);
|
||||||
CL_QUEUE_PROPERTIES,
|
|
||||||
static_cast<cl_queue_properties>(properties),
|
|
||||||
0 };
|
|
||||||
return clCreateCommandQueueWithProperties(
|
|
||||||
context, device, properties ? cprops : NULL, errcode_ret);
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -199,13 +189,12 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clRetainCommandQueue, (cl_command_queue command_queue))
|
RUNTIME_ENTRY(cl_int, clRetainCommandQueue, (cl_command_queue command_queue)) {
|
||||||
{
|
if (!is_valid(command_queue)) {
|
||||||
if (!is_valid(command_queue)) {
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
}
|
||||||
}
|
as_amd(command_queue)->retain();
|
||||||
as_amd(command_queue)->retain();
|
return CL_SUCCESS;
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -222,13 +211,12 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clReleaseCommandQueue, (cl_command_queue command_queue))
|
RUNTIME_ENTRY(cl_int, clReleaseCommandQueue, (cl_command_queue command_queue)) {
|
||||||
{
|
if (!is_valid(command_queue)) {
|
||||||
if (!is_valid(command_queue)) {
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
}
|
||||||
}
|
as_amd(command_queue)->release();
|
||||||
as_amd(command_queue)->release();
|
return CL_SUCCESS;
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -259,64 +247,51 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clGetCommandQueueInfo, (
|
RUNTIME_ENTRY(cl_int, clGetCommandQueueInfo,
|
||||||
cl_command_queue command_queue,
|
(cl_command_queue command_queue, cl_command_queue_info param_name,
|
||||||
cl_command_queue_info param_name,
|
size_t param_value_size, void* param_value, size_t* param_value_size_ret)) {
|
||||||
size_t param_value_size,
|
if (!is_valid(command_queue)) {
|
||||||
void *param_value,
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
size_t *param_value_size_ret))
|
}
|
||||||
{
|
|
||||||
if (!is_valid(command_queue)) {
|
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (param_name) {
|
switch (param_name) {
|
||||||
case CL_QUEUE_CONTEXT: {
|
case CL_QUEUE_CONTEXT: {
|
||||||
cl_context context = const_cast<cl_context>(
|
cl_context context = const_cast<cl_context>(as_cl(&as_amd(command_queue)->context()));
|
||||||
as_cl(&as_amd(command_queue)->context()));
|
return amd::clGetInfo(context, param_value_size, param_value, param_value_size_ret);
|
||||||
return amd::clGetInfo(
|
|
||||||
context, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
case CL_QUEUE_DEVICE: {
|
case CL_QUEUE_DEVICE: {
|
||||||
cl_device_id device = const_cast<cl_device_id>(
|
cl_device_id device = const_cast<cl_device_id>(as_cl(&as_amd(command_queue)->device()));
|
||||||
as_cl(&as_amd(command_queue)->device()));
|
return amd::clGetInfo(device, param_value_size, param_value, param_value_size_ret);
|
||||||
return amd::clGetInfo(
|
|
||||||
device, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
case CL_QUEUE_PROPERTIES: {
|
case CL_QUEUE_PROPERTIES: {
|
||||||
cl_command_queue_properties properties
|
cl_command_queue_properties properties = as_amd(command_queue)->properties().value_;
|
||||||
= as_amd(command_queue)->properties().value_;
|
return amd::clGetInfo(properties, param_value_size, param_value, param_value_size_ret);
|
||||||
return amd::clGetInfo(
|
|
||||||
properties, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
case CL_QUEUE_REFERENCE_COUNT: {
|
case CL_QUEUE_REFERENCE_COUNT: {
|
||||||
cl_uint count = as_amd(command_queue)->referenceCount();
|
cl_uint count = as_amd(command_queue)->referenceCount();
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(count, param_value_size, param_value, param_value_size_ret);
|
||||||
count, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
case CL_QUEUE_SIZE: {
|
case CL_QUEUE_SIZE: {
|
||||||
const amd::DeviceQueue* deviceQueue = as_amd(command_queue)->asDeviceQueue();
|
const amd::DeviceQueue* deviceQueue = as_amd(command_queue)->asDeviceQueue();
|
||||||
if (NULL == deviceQueue) {
|
if (NULL == deviceQueue) {
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
}
|
}
|
||||||
cl_uint size = deviceQueue->size();
|
cl_uint size = deviceQueue->size();
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(size, param_value_size, param_value, param_value_size_ret);
|
||||||
size, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
case CL_QUEUE_THREAD_HANDLE_AMD: {
|
case CL_QUEUE_THREAD_HANDLE_AMD: {
|
||||||
const amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
const amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
||||||
if (NULL == hostQueue) {
|
if (NULL == hostQueue) {
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
}
|
}
|
||||||
const void* handle = hostQueue->thread().handle();
|
const void* handle = hostQueue->thread().handle();
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(handle, param_value_size, param_value, param_value_size_ret);
|
||||||
handle, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -344,32 +319,27 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clSetCommandQueueProperty, (
|
RUNTIME_ENTRY(cl_int, clSetCommandQueueProperty,
|
||||||
cl_command_queue command_queue,
|
(cl_command_queue command_queue, cl_command_queue_properties properties,
|
||||||
cl_command_queue_properties properties,
|
cl_bool enable, cl_command_queue_properties* old_properties)) {
|
||||||
cl_bool enable,
|
if (!is_valid(command_queue)) {
|
||||||
cl_command_queue_properties *old_properties))
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
{
|
}
|
||||||
if (!is_valid(command_queue)) {
|
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
*not_null(old_properties)
|
*not_null(old_properties) = as_amd(command_queue)->properties().value_;
|
||||||
= as_amd(command_queue)->properties().value_;
|
|
||||||
|
|
||||||
if (properties & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE) {
|
if (properties & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE) {
|
||||||
clFinish(command_queue);
|
clFinish(command_queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool success;
|
bool success;
|
||||||
if (enable == CL_TRUE) {
|
if (enable == CL_TRUE) {
|
||||||
success = as_amd(command_queue)->properties().set(properties);
|
success = as_amd(command_queue)->properties().set(properties);
|
||||||
}
|
} else {
|
||||||
else {
|
success = as_amd(command_queue)->properties().clear(properties);
|
||||||
success = as_amd(command_queue)->properties().clear(properties);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return success ? CL_SUCCESS : CL_INVALID_QUEUE_PROPERTIES;
|
return success ? CL_SUCCESS : CL_INVALID_QUEUE_PROPERTIES;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "cl_d3d9_amd.hpp"
|
#include "cl_d3d9_amd.hpp"
|
||||||
#include "cl_d3d10_amd.hpp"
|
#include "cl_d3d10_amd.hpp"
|
||||||
#include "cl_d3d11_amd.hpp"
|
#include "cl_d3d11_amd.hpp"
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
#include "cl_kernel_info_amd.h"
|
#include "cl_kernel_info_amd.h"
|
||||||
#include "cl_profile_amd.h"
|
#include "cl_profile_amd.h"
|
||||||
#include "cl_platform_amd.h"
|
#include "cl_platform_amd.h"
|
||||||
@@ -81,63 +81,56 @@
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY_RET(cl_context, clCreateContext, (
|
RUNTIME_ENTRY_RET(cl_context, clCreateContext,
|
||||||
const cl_context_properties *properties,
|
(const cl_context_properties* properties, cl_uint num_devices,
|
||||||
cl_uint num_devices,
|
const cl_device_id* devices,
|
||||||
const cl_device_id *devices,
|
void(CL_CALLBACK* pfn_notify)(const char*, const void*, size_t, void*),
|
||||||
void (CL_CALLBACK * pfn_notify)(
|
void* user_data, cl_int* errcode_ret)) {
|
||||||
const char *,
|
cl_int errcode;
|
||||||
const void *,
|
amd::Context::Info info;
|
||||||
size_t,
|
|
||||||
void *),
|
|
||||||
void *user_data,
|
|
||||||
cl_int *errcode_ret))
|
|
||||||
{
|
|
||||||
cl_int errcode;
|
|
||||||
amd::Context::Info info;
|
|
||||||
|
|
||||||
errcode = amd::Context::checkProperties(properties, &info);
|
errcode = amd::Context::checkProperties(properties, &info);
|
||||||
if (CL_SUCCESS != errcode) {
|
if (CL_SUCCESS != errcode) {
|
||||||
*not_null(errcode_ret) = errcode;
|
*not_null(errcode_ret) = errcode;
|
||||||
return (cl_context) 0;
|
return (cl_context)0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (num_devices == 0 || devices == NULL) {
|
||||||
|
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||||
|
return (cl_context)0;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<amd::Device*> devices_;
|
||||||
|
for (cl_uint i = 0; i < num_devices; ++i) {
|
||||||
|
// FIXME_lmoriche: Set errcode_ret to CL_DEVICE_NOT_AVAILABLE if a
|
||||||
|
// device in devices is no longer available.
|
||||||
|
cl_device_id device = devices[i];
|
||||||
|
|
||||||
|
if (!is_valid(device)) {
|
||||||
|
*not_null(errcode_ret) = CL_INVALID_DEVICE;
|
||||||
|
return (cl_context)0;
|
||||||
}
|
}
|
||||||
|
devices_.push_back(as_amd(device));
|
||||||
|
}
|
||||||
|
|
||||||
if (num_devices == 0 || devices == NULL) {
|
amd::Context* context = new amd::Context(devices_, info);
|
||||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
if (context == NULL) {
|
||||||
return (cl_context) 0;
|
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
|
||||||
}
|
return (cl_context)0;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<amd::Device*> devices_;
|
if (CL_SUCCESS != (errcode = context->create(properties))) {
|
||||||
for (cl_uint i = 0; i < num_devices; ++i) {
|
context->release();
|
||||||
// FIXME_lmoriche: Set errcode_ret to CL_DEVICE_NOT_AVAILABLE if a
|
*not_null(errcode_ret) = errcode;
|
||||||
// device in devices is no longer available.
|
return (cl_context)0;
|
||||||
cl_device_id device = devices[i];
|
}
|
||||||
|
|
||||||
if (!is_valid(device)) {
|
if (amd::Agent::shouldPostContextEvents()) {
|
||||||
*not_null(errcode_ret) = CL_INVALID_DEVICE;
|
amd::Agent::postContextCreate(as_cl(context));
|
||||||
return (cl_context) 0;
|
}
|
||||||
}
|
|
||||||
devices_.push_back(as_amd(device));
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::Context* context = new amd::Context(devices_, info);
|
*not_null(errcode_ret) = CL_SUCCESS;
|
||||||
if (context == NULL) {
|
return as_cl(context);
|
||||||
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
|
|
||||||
return (cl_context) 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CL_SUCCESS != (errcode = context->create(properties))) {
|
|
||||||
context->release();
|
|
||||||
*not_null(errcode_ret) = errcode;
|
|
||||||
return (cl_context) 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (amd::Agent::shouldPostContextEvents()) {
|
|
||||||
amd::Agent::postContextCreate(as_cl(context));
|
|
||||||
}
|
|
||||||
|
|
||||||
*not_null(errcode_ret) = CL_SUCCESS;
|
|
||||||
return as_cl(context);
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -168,49 +161,38 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY_RET(cl_context, clCreateContextFromType, (
|
RUNTIME_ENTRY_RET(cl_context, clCreateContextFromType,
|
||||||
const cl_context_properties *properties,
|
(const cl_context_properties* properties, cl_device_type device_type,
|
||||||
cl_device_type device_type,
|
void(CL_CALLBACK* pfn_notify)(const char*, const void*, size_t, void*),
|
||||||
void (CL_CALLBACK * pfn_notify)(
|
void* user_data, cl_int* errcode_ret)) {
|
||||||
const char *,
|
amd::Context::Info info;
|
||||||
const void *,
|
cl_int errcode = amd::Context::checkProperties(properties, &info);
|
||||||
size_t,
|
if (errcode != CL_SUCCESS) {
|
||||||
void *),
|
*not_null(errcode_ret) = errcode;
|
||||||
void *user_data,
|
return (cl_context)0;
|
||||||
cl_int *errcode_ret))
|
}
|
||||||
{
|
|
||||||
amd::Context::Info info;
|
|
||||||
cl_int errcode = amd::Context::checkProperties(properties, &info);
|
|
||||||
if (errcode != CL_SUCCESS) {
|
|
||||||
*not_null(errcode_ret) = errcode;
|
|
||||||
return (cl_context) 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the devices of the given type.
|
// Get the devices of the given type.
|
||||||
cl_uint num_devices;
|
cl_uint num_devices;
|
||||||
bool offlineDevices =
|
bool offlineDevices = (info.flags_ & amd::Context::OfflineDevices) ? true : false;
|
||||||
(info.flags_ & amd::Context::OfflineDevices) ? true : false;
|
if (!amd::Device::getDeviceIDs(device_type, 0, NULL, &num_devices, offlineDevices)) {
|
||||||
if (!amd::Device::getDeviceIDs(device_type, 0, NULL,
|
*not_null(errcode_ret) = CL_DEVICE_NOT_FOUND;
|
||||||
&num_devices, offlineDevices)) {
|
return (cl_context)0;
|
||||||
*not_null(errcode_ret) = CL_DEVICE_NOT_FOUND;
|
}
|
||||||
return (cl_context) 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(num_devices > 0 && "Should have returned an error!");
|
assert(num_devices > 0 && "Should have returned an error!");
|
||||||
cl_device_id* devices = (cl_device_id *)
|
cl_device_id* devices = (cl_device_id*)alloca(num_devices * sizeof(cl_device_id));
|
||||||
alloca(num_devices * sizeof(cl_device_id));
|
|
||||||
|
|
||||||
if (!amd::Device::getDeviceIDs(device_type, num_devices,
|
if (!amd::Device::getDeviceIDs(device_type, num_devices, devices, NULL, offlineDevices)) {
|
||||||
devices, NULL, offlineDevices)) {
|
*not_null(errcode_ret) = CL_DEVICE_NOT_FOUND;
|
||||||
*not_null(errcode_ret) = CL_DEVICE_NOT_FOUND;
|
return (cl_context)0;
|
||||||
return (cl_context) 0;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Create a new context with the devices
|
// Create a new context with the devices
|
||||||
cl_context context = clCreateContext(
|
cl_context context =
|
||||||
properties, num_devices, devices, pfn_notify, user_data, errcode_ret);
|
clCreateContext(properties, num_devices, devices, pfn_notify, user_data, errcode_ret);
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -230,13 +212,12 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clRetainContext, (cl_context context))
|
RUNTIME_ENTRY(cl_int, clRetainContext, (cl_context context)) {
|
||||||
{
|
if (!is_valid(context)) {
|
||||||
if (!is_valid(context)) {
|
return CL_INVALID_CONTEXT;
|
||||||
return CL_INVALID_CONTEXT;
|
}
|
||||||
}
|
as_amd(context)->retain();
|
||||||
as_amd(context)->retain();
|
return CL_SUCCESS;
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -252,13 +233,12 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clReleaseContext, (cl_context context))
|
RUNTIME_ENTRY(cl_int, clReleaseContext, (cl_context context)) {
|
||||||
{
|
if (!is_valid(context)) {
|
||||||
if (!is_valid(context)) {
|
return CL_INVALID_CONTEXT;
|
||||||
return CL_INVALID_CONTEXT;
|
}
|
||||||
}
|
as_amd(context)->release();
|
||||||
as_amd(context)->release();
|
return CL_SUCCESS;
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -288,165 +268,159 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clGetContextInfo, (
|
RUNTIME_ENTRY(cl_int, clGetContextInfo,
|
||||||
cl_context context,
|
(cl_context context, cl_context_info param_name, size_t param_value_size,
|
||||||
cl_context_info param_name,
|
void* param_value, size_t* param_value_size_ret)) {
|
||||||
size_t param_value_size,
|
if (!is_valid(context)) {
|
||||||
void *param_value,
|
return CL_INVALID_CONTEXT;
|
||||||
size_t *param_value_size_ret))
|
}
|
||||||
{
|
|
||||||
if (!is_valid(context)) {
|
|
||||||
return CL_INVALID_CONTEXT;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (param_name) {
|
switch (param_name) {
|
||||||
case CL_CONTEXT_REFERENCE_COUNT: {
|
case CL_CONTEXT_REFERENCE_COUNT: {
|
||||||
cl_uint count = as_amd(context)->referenceCount();
|
cl_uint count = as_amd(context)->referenceCount();
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(count, param_value_size, param_value, param_value_size_ret);
|
||||||
count, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
case CL_CONTEXT_NUM_DEVICES: {
|
case CL_CONTEXT_NUM_DEVICES: {
|
||||||
cl_uint numDevices = (cl_uint)as_amd(context)->devices().size();
|
cl_uint numDevices = (cl_uint)as_amd(context)->devices().size();
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(numDevices, param_value_size, param_value, param_value_size_ret);
|
||||||
numDevices, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
case CL_CONTEXT_DEVICES: {
|
case CL_CONTEXT_DEVICES: {
|
||||||
const std::vector<amd::Device*>& devices = as_amd(context)->devices();
|
const std::vector<amd::Device*>& devices = as_amd(context)->devices();
|
||||||
size_t numDevices = devices.size();
|
size_t numDevices = devices.size();
|
||||||
size_t valueSize = numDevices * sizeof(cl_device_id*);
|
size_t valueSize = numDevices * sizeof(cl_device_id*);
|
||||||
|
|
||||||
if (param_value != NULL && param_value_size < valueSize) {
|
if (param_value != NULL && param_value_size < valueSize) {
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
|
}
|
||||||
|
*not_null(param_value_size_ret) = valueSize;
|
||||||
|
if (param_value != NULL) {
|
||||||
|
cl_device_id* device_list = (cl_device_id*)param_value;
|
||||||
|
std::vector<amd::Device*>::const_iterator it;
|
||||||
|
for (it = devices.begin(); it != devices.end(); ++it) {
|
||||||
|
*device_list++ = const_cast<cl_device_id>(as_cl(*it));
|
||||||
}
|
}
|
||||||
*not_null(param_value_size_ret) = valueSize;
|
}
|
||||||
if (param_value != NULL) {
|
return CL_SUCCESS;
|
||||||
cl_device_id* device_list = (cl_device_id*) param_value;
|
|
||||||
std::vector<amd::Device*>::const_iterator it;
|
|
||||||
for (it = devices.begin(); it != devices.end(); ++it) {
|
|
||||||
*device_list++ = const_cast<cl_device_id>(as_cl(*it));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
}
|
||||||
case CL_CONTEXT_PROPERTIES: {
|
case CL_CONTEXT_PROPERTIES: {
|
||||||
const amd::Context* amdContext = as_amd(context);
|
const amd::Context* amdContext = as_amd(context);
|
||||||
size_t valueSize = amdContext->info().propertiesSize_;
|
size_t valueSize = amdContext->info().propertiesSize_;
|
||||||
|
|
||||||
if (param_value != NULL && param_value_size < valueSize) {
|
if (param_value != NULL && param_value_size < valueSize) {
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
*not_null(param_value_size_ret) = valueSize;
|
*not_null(param_value_size_ret) = valueSize;
|
||||||
if ((param_value != NULL) && (valueSize != 0)) {
|
if ((param_value != NULL) && (valueSize != 0)) {
|
||||||
::memcpy(param_value, amdContext->properties(), valueSize);
|
::memcpy(param_value, amdContext->properties(), valueSize);
|
||||||
}
|
}
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
case CL_CONTEXT_D3D10_DEVICE_KHR: {
|
case CL_CONTEXT_D3D10_DEVICE_KHR: {
|
||||||
// Not defined in the ext.spec, but tested in the conf.test
|
// Not defined in the ext.spec, but tested in the conf.test
|
||||||
// Guessing functionality from the test...
|
// Guessing functionality from the test...
|
||||||
if (param_value != NULL && param_value_size < sizeof(void*)) {
|
if (param_value != NULL && param_value_size < sizeof(void*)) {
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
const amd::Context* amdContext = as_amd(context);
|
const amd::Context* amdContext = as_amd(context);
|
||||||
if (!(amdContext->info().flags_ & amd::Context::D3D10DeviceKhr)) {
|
if (!(amdContext->info().flags_ & amd::Context::D3D10DeviceKhr)) {
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
*not_null(param_value_size_ret) = sizeof(intptr_t);
|
*not_null(param_value_size_ret) = sizeof(intptr_t);
|
||||||
if (param_value != NULL) {
|
if (param_value != NULL) {
|
||||||
*(intptr_t*) param_value =
|
*(intptr_t*)param_value =
|
||||||
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D10DeviceKhrIdx]);
|
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D10DeviceKhrIdx]);
|
||||||
}
|
}
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
case CL_CONTEXT_D3D10_PREFER_SHARED_RESOURCES_KHR: {
|
case CL_CONTEXT_D3D10_PREFER_SHARED_RESOURCES_KHR: {
|
||||||
if (param_value != NULL && param_value_size < sizeof(cl_bool)) {
|
if (param_value != NULL && param_value_size < sizeof(cl_bool)) {
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
*not_null(param_value_size_ret) = sizeof(cl_bool);
|
*not_null(param_value_size_ret) = sizeof(cl_bool);
|
||||||
if (param_value != NULL) {
|
if (param_value != NULL) {
|
||||||
*(cl_bool*) param_value = CL_TRUE;
|
*(cl_bool*)param_value = CL_TRUE;
|
||||||
}
|
}
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
case CL_CONTEXT_D3D11_DEVICE_KHR: {
|
case CL_CONTEXT_D3D11_DEVICE_KHR: {
|
||||||
// Not defined in the ext.spec, but tested in the conf.test
|
// Not defined in the ext.spec, but tested in the conf.test
|
||||||
// Guessing functionality from the test...
|
// Guessing functionality from the test...
|
||||||
if (param_value != NULL && param_value_size < sizeof(void*)) {
|
if (param_value != NULL && param_value_size < sizeof(void*)) {
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
const amd::Context* amdContext = as_amd(context);
|
const amd::Context* amdContext = as_amd(context);
|
||||||
if (!(amdContext->info().flags_ & amd::Context::D3D11DeviceKhr)) {
|
if (!(amdContext->info().flags_ & amd::Context::D3D11DeviceKhr)) {
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
*not_null(param_value_size_ret) = sizeof(intptr_t);
|
*not_null(param_value_size_ret) = sizeof(intptr_t);
|
||||||
if (param_value != NULL) {
|
if (param_value != NULL) {
|
||||||
*(intptr_t*) param_value =
|
*(intptr_t*)param_value =
|
||||||
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D11DeviceKhrIdx]);
|
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D11DeviceKhrIdx]);
|
||||||
}
|
}
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
case CL_CONTEXT_D3D11_PREFER_SHARED_RESOURCES_KHR: {
|
case CL_CONTEXT_D3D11_PREFER_SHARED_RESOURCES_KHR: {
|
||||||
if (param_value != NULL && param_value_size < sizeof(cl_bool)) {
|
if (param_value != NULL && param_value_size < sizeof(cl_bool)) {
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
*not_null(param_value_size_ret) = sizeof(cl_bool);
|
*not_null(param_value_size_ret) = sizeof(cl_bool);
|
||||||
if (param_value != NULL) {
|
if (param_value != NULL) {
|
||||||
*(cl_bool*) param_value = CL_TRUE;
|
*(cl_bool*)param_value = CL_TRUE;
|
||||||
}
|
}
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
case CL_CONTEXT_ADAPTER_D3D9_KHR: {
|
case CL_CONTEXT_ADAPTER_D3D9_KHR: {
|
||||||
if (param_value != NULL && param_value_size < sizeof(void*)) {
|
if (param_value != NULL && param_value_size < sizeof(void*)) {
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
const amd::Context* amdContext = as_amd(context);
|
const amd::Context* amdContext = as_amd(context);
|
||||||
if (!(amdContext->info().flags_ & amd::Context::D3D9DeviceKhr)) {
|
if (!(amdContext->info().flags_ & amd::Context::D3D9DeviceKhr)) {
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
*not_null(param_value_size_ret) = sizeof(intptr_t);
|
*not_null(param_value_size_ret) = sizeof(intptr_t);
|
||||||
if (param_value != NULL) {
|
if (param_value != NULL) {
|
||||||
*(intptr_t*) param_value =
|
*(intptr_t*)param_value =
|
||||||
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D9DeviceKhrIdx]);
|
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D9DeviceKhrIdx]);
|
||||||
}
|
}
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
case CL_CONTEXT_ADAPTER_D3D9EX_KHR: {
|
case CL_CONTEXT_ADAPTER_D3D9EX_KHR: {
|
||||||
if (param_value != NULL && param_value_size < sizeof(void*)) {
|
if (param_value != NULL && param_value_size < sizeof(void*)) {
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
const amd::Context* amdContext = as_amd(context);
|
const amd::Context* amdContext = as_amd(context);
|
||||||
if (!(amdContext->info().flags_ & amd::Context::D3D9DeviceEXKhr)) {
|
if (!(amdContext->info().flags_ & amd::Context::D3D9DeviceEXKhr)) {
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
*not_null(param_value_size_ret) = sizeof(intptr_t);
|
*not_null(param_value_size_ret) = sizeof(intptr_t);
|
||||||
if (param_value != NULL) {
|
if (param_value != NULL) {
|
||||||
*(intptr_t*) param_value =
|
*(intptr_t*)param_value =
|
||||||
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D9DeviceEXKhrIdx]);
|
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D9DeviceEXKhrIdx]);
|
||||||
}
|
}
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
case CL_CONTEXT_ADAPTER_DXVA_KHR: {
|
case CL_CONTEXT_ADAPTER_DXVA_KHR: {
|
||||||
if (param_value != NULL && param_value_size < sizeof(void*)) {
|
if (param_value != NULL && param_value_size < sizeof(void*)) {
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
const amd::Context* amdContext = as_amd(context);
|
const amd::Context* amdContext = as_amd(context);
|
||||||
if (!(amdContext->info().flags_ & amd::Context::D3D9DeviceVAKhr)) {
|
if (!(amdContext->info().flags_ & amd::Context::D3D9DeviceVAKhr)) {
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
*not_null(param_value_size_ret) = sizeof(intptr_t);
|
*not_null(param_value_size_ret) = sizeof(intptr_t);
|
||||||
if (param_value != NULL) {
|
if (param_value != NULL) {
|
||||||
*(intptr_t*) param_value =
|
*(intptr_t*)param_value =
|
||||||
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D9DeviceVAKhrIdx]);
|
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D9DeviceVAKhrIdx]);
|
||||||
}
|
}
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
#endif //_WIN32
|
#endif //_WIN32
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -465,158 +439,151 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.2r07
|
* \version 1.2r07
|
||||||
*/
|
*/
|
||||||
CL_API_ENTRY void* CL_API_CALL clGetExtensionFunctionAddressForPlatform(
|
CL_API_ENTRY void* CL_API_CALL clGetExtensionFunctionAddressForPlatform(cl_platform_id platform,
|
||||||
cl_platform_id platform,
|
const char* funcname) {
|
||||||
const char *funcname)
|
if (platform != NULL && platform != AMD_PLATFORM) {
|
||||||
{
|
return NULL;
|
||||||
if (platform != NULL && platform != AMD_PLATFORM) {
|
}
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return clGetExtensionFunctionAddress(funcname);
|
return clGetExtensionFunctionAddress(funcname);
|
||||||
}
|
}
|
||||||
|
|
||||||
CL_API_ENTRY void* CL_API_CALL
|
CL_API_ENTRY void* CL_API_CALL clGetExtensionFunctionAddress(const char* func_name) {
|
||||||
clGetExtensionFunctionAddress(const char* func_name)
|
#define CL_EXTENSION_ENTRYPOINT_CHECK(name) \
|
||||||
{
|
if (!strcmp(func_name, #name)) return reinterpret_cast<void*>(name);
|
||||||
#define CL_EXTENSION_ENTRYPOINT_CHECK(name) \
|
#define CL_EXTENSION_ENTRYPOINT_CHECK2(name1, name2) \
|
||||||
if (!strcmp(func_name, #name)) return reinterpret_cast<void*>(name);
|
if (!strcmp(func_name, #name1)) return reinterpret_cast<void*>(name2);
|
||||||
#define CL_EXTENSION_ENTRYPOINT_CHECK2(name1,name2) \
|
|
||||||
if (!strcmp(func_name, #name1)) return reinterpret_cast<void*>(name2);
|
|
||||||
|
|
||||||
switch (func_name[2]) {
|
switch (func_name[2]) {
|
||||||
case 'C':
|
case 'C':
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateEventFromGLsyncKHR);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateEventFromGLsyncKHR);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreatePerfCounterAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clCreatePerfCounterAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateThreadTraceAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateThreadTraceAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromGLBuffer);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromGLBuffer);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromGLTexture2D);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromGLTexture2D);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromGLTexture3D);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromGLTexture3D);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromGLRenderbuffer);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromGLRenderbuffer);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromD3D10BufferKHR);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromD3D10BufferKHR);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromD3D10Texture2DKHR);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromD3D10Texture2DKHR);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromD3D10Texture3DKHR);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromD3D10Texture3DKHR);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromDX9MediaSurfaceKHR);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromDX9MediaSurfaceKHR);
|
||||||
#endif //_WIN32
|
#endif //_WIN32
|
||||||
#ifdef cl_ext_device_fission
|
#ifdef cl_ext_device_fission
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateSubDevicesEXT);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateSubDevicesEXT);
|
||||||
#endif // cl_ext_device_fission
|
#endif // cl_ext_device_fission
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateKeyAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateKeyAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clConvertImageAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clConvertImageAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateBufferFromImageAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateBufferFromImageAMD);
|
||||||
#if cl_khr_il_program
|
#if cl_khr_il_program
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateProgramWithILKHR);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateProgramWithILKHR);
|
||||||
#endif // cl_khr_il_program
|
#endif // cl_khr_il_program
|
||||||
#if cl_amd_liquid_flash
|
#if cl_amd_liquid_flash
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateSsgFileObjectAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateSsgFileObjectAMD);
|
||||||
#endif // cl_amd_liquid_flash
|
#endif // cl_amd_liquid_flash
|
||||||
break;
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
break;
|
break;
|
||||||
case 'E':
|
case 'E':
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueBeginPerfCounterAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueBeginPerfCounterAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueEndPerfCounterAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueEndPerfCounterAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueAcquireGLObjects);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueAcquireGLObjects);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueReleaseGLObjects);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueReleaseGLObjects);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueBindThreadTraceBufferAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueBindThreadTraceBufferAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueThreadTraceCommandAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueThreadTraceCommandAMD);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueAcquireD3D10ObjectsKHR);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueAcquireD3D10ObjectsKHR);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueReleaseD3D10ObjectsKHR);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueReleaseD3D10ObjectsKHR);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueAcquireDX9MediaSurfacesKHR);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueAcquireDX9MediaSurfacesKHR);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueReleaseDX9MediaSurfacesKHR);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueReleaseDX9MediaSurfacesKHR);
|
||||||
#endif //_WIN32
|
#endif //_WIN32
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueWaitSignalAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueWaitSignalAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueWriteSignalAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueWriteSignalAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueMakeBuffersResidentAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueMakeBuffersResidentAMD);
|
||||||
#if cl_amd_liquid_flash
|
#if cl_amd_liquid_flash
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueReadSsgFileAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueReadSsgFileAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueWriteSsgFileAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueWriteSsgFileAMD);
|
||||||
#endif // cl_amd_liquid_flash
|
#endif // cl_amd_liquid_flash
|
||||||
break;
|
break;
|
||||||
case 'G':
|
case 'G':
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clGetKernelInfoAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clGetKernelInfoAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clGetPerfCounterInfoAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clGetPerfCounterInfoAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clGetGLObjectInfo);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clGetGLObjectInfo);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clGetGLTextureInfo);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clGetGLTextureInfo);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clGetGLContextInfoKHR);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clGetGLContextInfoKHR);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clGetThreadTraceInfoAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clGetThreadTraceInfoAMD);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clGetDeviceIDsFromD3D10KHR);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clGetDeviceIDsFromD3D10KHR);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clGetDeviceIDsFromDX9MediaAdapterKHR);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clGetDeviceIDsFromDX9MediaAdapterKHR);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clGetPlaneFromImageAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clGetPlaneFromImageAMD);
|
||||||
#endif //_WIN32
|
#endif //_WIN32
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clGetKernelSubGroupInfoKHR);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clGetKernelSubGroupInfoKHR);
|
||||||
#if cl_amd_liquid_flash
|
#if cl_amd_liquid_flash
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clGetSsgFileObjectInfoAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clGetSsgFileObjectInfoAMD);
|
||||||
#endif // cl_amd_liquid_flash
|
#endif // cl_amd_liquid_flash
|
||||||
break;
|
break;
|
||||||
case 'H':
|
case 'H':
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetCallBackFunctionsAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetCallBackFunctionsAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetCallBackArgumentsAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetCallBackArgumentsAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgFlushCacheAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgFlushCacheAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetExceptionPolicyAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetExceptionPolicyAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgGetExceptionPolicyAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgGetExceptionPolicyAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetKernelExecutionModeAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetKernelExecutionModeAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgGetKernelExecutionModeAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgGetKernelExecutionModeAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgCreateEventAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgCreateEventAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgWaitEventAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgWaitEventAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgDestroyEventAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgDestroyEventAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgRegisterDebuggerAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgRegisterDebuggerAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgUnregisterDebuggerAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgUnregisterDebuggerAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetAclBinaryAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetAclBinaryAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgWaveControlAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgWaveControlAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgAddressWatchAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgAddressWatchAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgGetAqlPacketInfoAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgGetAqlPacketInfoAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgGetDispatchDebugInfoAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgGetDispatchDebugInfoAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgMapKernelCodeAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgMapKernelCodeAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgUnmapKernelCodeAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgUnmapKernelCodeAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgMapScratchRingAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgMapScratchRingAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgUnmapScratchRingAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgUnmapScratchRingAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgGetKernelParamMemAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgGetKernelParamMemAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetGlobalMemoryAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetGlobalMemoryAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgInstallTrapAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgInstallTrapAMD);
|
||||||
#endif //_WIN32
|
#endif //_WIN32
|
||||||
break;
|
break;
|
||||||
case 'I':
|
case 'I':
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clIcdGetPlatformIDsKHR);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clIcdGetPlatformIDsKHR);
|
||||||
break;
|
break;
|
||||||
case 'O':
|
case 'O':
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clObjectGetValueForKeyAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clObjectGetValueForKeyAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clObjectSetValueForKeyAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clObjectSetValueForKeyAMD);
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clReleasePerfCounterAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clReleasePerfCounterAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clRetainPerfCounterAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clRetainPerfCounterAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clReleaseThreadTraceAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clReleaseThreadTraceAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clRetainThreadTraceAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clRetainThreadTraceAMD);
|
||||||
#ifdef cl_ext_device_fission
|
#ifdef cl_ext_device_fission
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clRetainDeviceEXT);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clRetainDeviceEXT);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clReleaseDeviceEXT);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clReleaseDeviceEXT);
|
||||||
#endif // cl_ext_device_fission
|
#endif // cl_ext_device_fission
|
||||||
#if cl_amd_liquid_flash
|
#if cl_amd_liquid_flash
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clRetainSsgFileObjectAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clRetainSsgFileObjectAMD);
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clReleaseSsgFileObjectAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clReleaseSsgFileObjectAMD);
|
||||||
#endif // cl_amd_liquid_flash
|
#endif // cl_amd_liquid_flash
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clSetThreadTraceParamAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clSetThreadTraceParamAMD);
|
||||||
break;
|
break;
|
||||||
case 'U':
|
case 'U':
|
||||||
CL_EXTENSION_ENTRYPOINT_CHECK(clUnloadPlatformAMD);
|
CL_EXTENSION_ENTRYPOINT_CHECK(clUnloadPlatformAMD);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
RUNTIME_ENTRY(cl_int, clTerminateContextKHR, (cl_context context))
|
RUNTIME_ENTRY(cl_int, clTerminateContextKHR, (cl_context context)) { return CL_INVALID_CONTEXT; }
|
||||||
{
|
|
||||||
return CL_INVALID_CONTEXT;
|
|
||||||
}
|
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,14 +25,11 @@
|
|||||||
*
|
*
|
||||||
* \version 1.1r18
|
* \version 1.1r18
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY_RET(cl_counter_amd, clCreateCounterAMD, (
|
RUNTIME_ENTRY_RET(cl_counter_amd, clCreateCounterAMD,
|
||||||
cl_context context,
|
(cl_context context, cl_counter_flags_amd flags, cl_uint value,
|
||||||
cl_counter_flags_amd flags,
|
cl_int* errcode_ret)) {
|
||||||
cl_uint value,
|
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
|
||||||
cl_int * errcode_ret))
|
return (cl_counter_amd)0;
|
||||||
{
|
|
||||||
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
|
|
||||||
return (cl_counter_amd)0;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -40,14 +37,10 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.1r18
|
* \version 1.1r18
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clGetCounterInfoAMD, (
|
RUNTIME_ENTRY(cl_int, clGetCounterInfoAMD,
|
||||||
cl_counter_amd counter,
|
(cl_counter_amd counter, cl_counter_info_amd param_name, size_t param_value_size,
|
||||||
cl_counter_info_amd param_name,
|
void* param_value, size_t* param_value_size_ret)) {
|
||||||
size_t param_value_size,
|
return CL_INVALID_COUNTER_AMD;
|
||||||
void * param_value,
|
|
||||||
size_t * param_value_size_ret))
|
|
||||||
{
|
|
||||||
return CL_INVALID_COUNTER_AMD;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -60,13 +53,12 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.1r18
|
* \version 1.1r18
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clRetainCounterAMD, (cl_counter_amd counter))
|
RUNTIME_ENTRY(cl_int, clRetainCounterAMD, (cl_counter_amd counter)) {
|
||||||
{
|
if (!is_valid(counter)) {
|
||||||
if (!is_valid(counter)) {
|
return CL_INVALID_COUNTER_AMD;
|
||||||
return CL_INVALID_COUNTER_AMD;
|
}
|
||||||
}
|
as_amd(counter)->retain();
|
||||||
as_amd(counter)->retain();
|
return CL_SUCCESS;
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -79,13 +71,12 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.1r18
|
* \version 1.1r18
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clReleaseCounterAMD, (cl_counter_amd counter))
|
RUNTIME_ENTRY(cl_int, clReleaseCounterAMD, (cl_counter_amd counter)) {
|
||||||
{
|
if (!is_valid(counter)) {
|
||||||
if (!is_valid(counter)) {
|
return CL_INVALID_COUNTER_AMD;
|
||||||
return CL_INVALID_COUNTER_AMD;
|
}
|
||||||
}
|
as_amd(counter)->release();
|
||||||
as_amd(counter)->release();
|
return CL_SUCCESS;
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -93,16 +84,11 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.1r18
|
* \version 1.1r18
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clEnqueueReadCounterAMD, (
|
RUNTIME_ENTRY(cl_int, clEnqueueReadCounterAMD,
|
||||||
cl_command_queue command_queue,
|
(cl_command_queue command_queue, cl_counter_amd counter, cl_bool blocking_read,
|
||||||
cl_counter_amd counter,
|
cl_uint* value, cl_uint num_events_in_wait_list, const cl_event* event_wait_list,
|
||||||
cl_bool blocking_read,
|
cl_event* event)) {
|
||||||
cl_uint * value,
|
return CL_INVALID_COUNTER_AMD;
|
||||||
cl_uint num_events_in_wait_list,
|
|
||||||
const cl_event * event_wait_list,
|
|
||||||
cl_event * event))
|
|
||||||
{
|
|
||||||
return CL_INVALID_COUNTER_AMD;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -110,16 +96,11 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.1r18
|
* \version 1.1r18
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clEnqueueWriteCounterAMD, (
|
RUNTIME_ENTRY(cl_int, clEnqueueWriteCounterAMD,
|
||||||
cl_command_queue command_queue,
|
(cl_command_queue command_queue, cl_counter_amd counter, cl_bool blocking_write,
|
||||||
cl_counter_amd counter,
|
cl_uint value, cl_uint num_events_in_wait_list, const cl_event* event_wait_list,
|
||||||
cl_bool blocking_write,
|
cl_event* event)) {
|
||||||
cl_uint value,
|
return CL_INVALID_COUNTER_AMD;
|
||||||
cl_uint num_events_in_wait_list,
|
|
||||||
const cl_event * event_wait_list,
|
|
||||||
cl_event * event))
|
|
||||||
{
|
|
||||||
return CL_INVALID_COUNTER_AMD;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -127,4 +108,4 @@ RUNTIME_EXIT
|
|||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#endif // cl_amd_atomic_counters
|
#endif // cl_amd_atomic_counters
|
||||||
|
|||||||
+1112
-1275
File diff suppressed because it is too large
Load Diff
+1299
-1466
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -106,22 +106,21 @@ jurisdiction and venue of these courts.
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /*__cplusplus*/
|
#endif /*__cplusplus*/
|
||||||
|
|
||||||
#define CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD -80
|
#define CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD -80
|
||||||
#define CL_DEBUGGER_REGISTER_FAILURE_AMD -81
|
#define CL_DEBUGGER_REGISTER_FAILURE_AMD -81
|
||||||
#define CL_TRAP_HANDLER_NOT_DEFINED_AMD -82
|
#define CL_TRAP_HANDLER_NOT_DEFINED_AMD -82
|
||||||
#define CL_EVENT_TIMEOUT_AMD -83
|
#define CL_EVENT_TIMEOUT_AMD -83
|
||||||
|
|
||||||
|
|
||||||
typedef uintptr_t cl_dbg_event_amd; //! debug event
|
typedef uintptr_t cl_dbg_event_amd; //! debug event
|
||||||
|
|
||||||
/*! \brief Trap Handler Type
|
/*! \brief Trap Handler Type
|
||||||
*
|
*
|
||||||
* The trap handler for each support type.
|
* The trap handler for each support type.
|
||||||
*/
|
*/
|
||||||
enum cl_dbg_trap_type_amd
|
enum cl_dbg_trap_type_amd {
|
||||||
{
|
CL_DBG_DEBUG_TRAP = 0, //! HW debug
|
||||||
CL_DBG_DEBUG_TRAP = 0, //! HW debug
|
CL_DBG_MAX_TRAP
|
||||||
CL_DBG_MAX_TRAP
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! \brief Wave actions used to control the wave execution on the hardware
|
/*! \brief Wave actions used to control the wave execution on the hardware
|
||||||
@@ -130,15 +129,14 @@ enum cl_dbg_trap_type_amd
|
|||||||
* behavior when calling the wave control function. Overall, there are
|
* behavior when calling the wave control function. Overall, there are
|
||||||
* five types of operations that can be specified.
|
* five types of operations that can be specified.
|
||||||
*/
|
*/
|
||||||
enum cl_dbg_waves_action_amd
|
enum cl_dbg_waves_action_amd {
|
||||||
{
|
CL_DBG_WAVES_DONT_USE_ZERO = 0, //! NOT USED
|
||||||
CL_DBG_WAVES_DONT_USE_ZERO = 0, //! NOT USED
|
CL_DBG_WAVES_HALT = 1, //! halt wave
|
||||||
CL_DBG_WAVES_HALT = 1, //! halt wave
|
CL_DBG_WAVES_RESUME = 2, //! resume wave
|
||||||
CL_DBG_WAVES_RESUME = 2, //! resume wave
|
CL_DBG_WAVES_KILL = 3, //! kill wave
|
||||||
CL_DBG_WAVES_KILL = 3, //! kill wave
|
CL_DBG_WAVES_DEBUG = 4, //! debug wave
|
||||||
CL_DBG_WAVES_DEBUG = 4, //! debug wave
|
CL_DBG_WAVES_TRAP = 5, //! trap
|
||||||
CL_DBG_WAVES_TRAP = 5, //! trap
|
CL_DBG_WAVES_MAX
|
||||||
CL_DBG_WAVES_MAX
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! \brief Host actions when encountering an exception in the kernel.
|
/*! \brief Host actions when encountering an exception in the kernel.
|
||||||
@@ -146,11 +144,10 @@ enum cl_dbg_waves_action_amd
|
|||||||
* The host action enumeration is used to specify the desired host
|
* The host action enumeration is used to specify the desired host
|
||||||
* response in the event thatn a device kernel exception is encountered.
|
* response in the event thatn a device kernel exception is encountered.
|
||||||
*/
|
*/
|
||||||
enum cl_dbg_host_action_amd
|
enum cl_dbg_host_action_amd {
|
||||||
{
|
CL_DBG_HOST_IGNORE = 1, //! ignore the kernel exception
|
||||||
CL_DBG_HOST_IGNORE = 1, //! ignore the kernel exception
|
CL_DBG_HOST_EXIT = 2, //! exit the host application on a kernel exception
|
||||||
CL_DBG_HOST_EXIT = 2, //! exit the host application on a kernel exception
|
CL_DBG_HOST_NOTIFY = 4 //! report the kernel exception
|
||||||
CL_DBG_HOST_NOTIFY = 4 //! report the kernel exception
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! \brief Mode of the wave action when calling the wave control function
|
/*! \brief Mode of the wave action when calling the wave control function
|
||||||
@@ -158,25 +155,23 @@ enum cl_dbg_host_action_amd
|
|||||||
* The wave mode enumerations are used to specify the desired
|
* The wave mode enumerations are used to specify the desired
|
||||||
* broadcast level when calling the wave control function.
|
* broadcast level when calling the wave control function.
|
||||||
*/
|
*/
|
||||||
enum cl_dbg_wave_mode_amd
|
enum cl_dbg_wave_mode_amd {
|
||||||
{
|
CL_DBG_WAVEMODE_SINGLE = 0, //! send command to single wave
|
||||||
CL_DBG_WAVEMODE_SINGLE = 0, //! send command to single wave
|
CL_DBG_WAVEMODE_BROADCAST = 2, //! send command to wave with match VMID
|
||||||
CL_DBG_WAVEMODE_BROADCAST = 2, //! send command to wave with match VMID
|
CL_DBG_WAVEMODE_BROADCAST_CU = 3, //! send command to wave with match VMID with specific CU
|
||||||
CL_DBG_WAVEMODE_BROADCAST_CU = 3, //! send command to wave with match VMID with specific CU
|
CL_DBG_WAVEMODE_MAX
|
||||||
CL_DBG_WAVEMODE_MAX
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! \brief Enumeration of address watch mode
|
/*! \brief Enumeration of address watch mode
|
||||||
*
|
*
|
||||||
* This enumeration indicates the different modes of address watch.
|
* This enumeration indicates the different modes of address watch.
|
||||||
*/
|
*/
|
||||||
enum cl_dbg_address_watch_mode_amd
|
enum cl_dbg_address_watch_mode_amd {
|
||||||
{
|
CL_DBG_ADDR_WATCH_MODE_READ = 0, //! Read operations only
|
||||||
CL_DBG_ADDR_WATCH_MODE_READ = 0, //! Read operations only
|
CL_DBG_ADDR_WATCH_MODE_NONREAD = 1, //! Write or Atomic operations only
|
||||||
CL_DBG_ADDR_WATCH_MODE_NONREAD = 1, //! Write or Atomic operations only
|
CL_DBG_ADDR_WATCH_MODE_ATOMIC = 2, //! Atomic Operations only
|
||||||
CL_DBG_ADDR_WATCH_MODE_ATOMIC = 2, //! Atomic Operations only
|
CL_DBG_ADDR_WATCH_MODE_ALL = 3, //! Read, Write or Atomic operations
|
||||||
CL_DBG_ADDR_WATCH_MODE_ALL = 3, //! Read, Write or Atomic operations
|
CL_DBG_ADDR_WATCH_MODE_MAX //! Number of address watch modes
|
||||||
CL_DBG_ADDR_WATCH_MODE_MAX //! Number of address watch modes
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! \brief Dispatch exception policy descriptor
|
/*! \brief Dispatch exception policy descriptor
|
||||||
@@ -185,12 +180,11 @@ enum cl_dbg_address_watch_mode_amd
|
|||||||
* expected exception policy in the event an exception is encountered
|
* expected exception policy in the event an exception is encountered
|
||||||
* on the associated dispatch.
|
* on the associated dispatch.
|
||||||
*/
|
*/
|
||||||
typedef struct _cl_dbg_exception_policy_amd
|
typedef struct _cl_dbg_exception_policy_amd {
|
||||||
{
|
cl_uint exceptionMask; //! exception mask
|
||||||
cl_uint exceptionMask; //! exception mask
|
cl_dbg_waves_action_amd waveAction; //! wave action
|
||||||
cl_dbg_waves_action_amd waveAction; //! wave action
|
cl_dbg_host_action_amd hostAction; //! host action
|
||||||
cl_dbg_host_action_amd hostAction; //! host action
|
cl_dbg_wave_mode_amd waveMode; //! wave mode
|
||||||
cl_dbg_wave_mode_amd waveMode; //! wave mode
|
|
||||||
} cl_dbg_exception_policy_amd;
|
} cl_dbg_exception_policy_amd;
|
||||||
|
|
||||||
/*! \brief Kernel execution mode
|
/*! \brief Kernel execution mode
|
||||||
@@ -205,83 +199,78 @@ typedef struct _cl_dbg_exception_policy_amd
|
|||||||
* 5. Disable L2 cache (0: enable (default), 1: disable)
|
* 5. Disable L2 cache (0: enable (default), 1: disable)
|
||||||
* 6. Num of CUs reserved for display (0 (default), 7: max)
|
* 6. Num of CUs reserved for display (0 (default), 7: max)
|
||||||
*/
|
*/
|
||||||
typedef struct _cl_dbg_kernel_exec_mode_amd
|
typedef struct _cl_dbg_kernel_exec_mode_amd {
|
||||||
{
|
union {
|
||||||
union {
|
struct {
|
||||||
struct {
|
cl_uint monitorMode : 1;
|
||||||
cl_uint monitorMode : 1;
|
cl_uint gpuSingleStepMode : 1;
|
||||||
cl_uint gpuSingleStepMode : 1;
|
cl_uint disableL1Scalar : 1;
|
||||||
cl_uint disableL1Scalar : 1;
|
cl_uint disableL1Vector : 1;
|
||||||
cl_uint disableL1Vector : 1;
|
cl_uint disableL2Cache : 1;
|
||||||
cl_uint disableL2Cache : 1;
|
cl_uint reservedCuNum : 3;
|
||||||
cl_uint reservedCuNum : 3;
|
cl_uint reserved : 24;
|
||||||
cl_uint reserved : 24;
|
|
||||||
};
|
|
||||||
cl_uint ui32All;
|
|
||||||
};
|
};
|
||||||
|
cl_uint ui32All;
|
||||||
|
};
|
||||||
} cl_dbg_kernel_exec_mode_amd;
|
} cl_dbg_kernel_exec_mode_amd;
|
||||||
|
|
||||||
/*! \brief GPU cache mask
|
/*! \brief GPU cache mask
|
||||||
*
|
*
|
||||||
* This structure is used to specify the GPU cache to be flushed/invalidated
|
* This structure is used to specify the GPU cache to be flushed/invalidated
|
||||||
*/
|
*/
|
||||||
typedef struct _cl_dbg_gpu_cache_mask_amd
|
typedef struct _cl_dbg_gpu_cache_mask_amd {
|
||||||
{
|
union {
|
||||||
union {
|
struct {
|
||||||
struct {
|
cl_uint sqICache : 1; //! instruction cache
|
||||||
cl_uint sqICache : 1; //! instruction cache
|
cl_uint sqKCache : 1; //! data cache
|
||||||
cl_uint sqKCache : 1; //! data cache
|
cl_uint tcL1 : 1; //! tcL1 cache
|
||||||
cl_uint tcL1 : 1; //! tcL1 cache
|
cl_uint tcL2 : 1; //! tcL2 cache
|
||||||
cl_uint tcL2 : 1; //! tcL2 cache
|
cl_uint reserved : 28;
|
||||||
cl_uint reserved : 28;
|
|
||||||
};
|
|
||||||
cl_uint ui32All;
|
|
||||||
};
|
};
|
||||||
|
cl_uint ui32All;
|
||||||
|
};
|
||||||
} cl_dbg_gpu_cache_mask_amd;
|
} cl_dbg_gpu_cache_mask_amd;
|
||||||
|
|
||||||
/*! \brief Dispatch Debug Info
|
/*! \brief Dispatch Debug Info
|
||||||
*
|
*
|
||||||
* This structure is used to store the scratch and global memory descriptors
|
* This structure is used to store the scratch and global memory descriptors
|
||||||
*/
|
*/
|
||||||
typedef struct _cl_dispatch_debug_info_amd
|
typedef struct _cl_dispatch_debug_info_amd {
|
||||||
{
|
cl_uint scratchMemoryDescriptor[4]; //! Scratch memory descriptors
|
||||||
cl_uint scratchMemoryDescriptor[4]; //! Scratch memory descriptors
|
cl_uint globalMemoryDescriptor[4]; //! Global memory descriptors
|
||||||
cl_uint globalMemoryDescriptor[4]; //! Global memory descriptors
|
|
||||||
} cl_dispatch_debug_info_amd;
|
} cl_dispatch_debug_info_amd;
|
||||||
|
|
||||||
/*! \brief AQL Packet Info
|
/*! \brief AQL Packet Info
|
||||||
*
|
*
|
||||||
* This structure is used to store AQL packet informatin for kernel dispatch
|
* This structure is used to store AQL packet informatin for kernel dispatch
|
||||||
*/
|
*/
|
||||||
typedef struct _cl_aql_packet_info_amd
|
typedef struct _cl_aql_packet_info_amd {
|
||||||
{
|
cl_uint trapReservedVgprIndex; //! VGPR index reserved for trap
|
||||||
cl_uint trapReservedVgprIndex; //! VGPR index reserved for trap
|
//! value is -1 when kernel was not compiled
|
||||||
//! value is -1 when kernel was not compiled
|
//! in debug mode.
|
||||||
//! in debug mode.
|
cl_uint scratchBufferWaveOffset; //! scratch buffer wave offset
|
||||||
cl_uint scratchBufferWaveOffset; //! scratch buffer wave offset
|
//! value is -1 when kernel was not compiled
|
||||||
//! value is -1 when kernel was not compiled
|
//! in debug mode or scratch buffer is not enabled
|
||||||
//! in debug mode or scratch buffer is not enabled
|
void* pointerToIsaBuffer; //! Pointer to buffer containing ISA
|
||||||
void *pointerToIsaBuffer; //! Pointer to buffer containing ISA
|
size_t sizeOfIsaBuffer; //! Size of the ISA buffer
|
||||||
size_t sizeOfIsaBuffer; //! Size of the ISA buffer
|
|
||||||
|
|
||||||
cl_uint numberOfVgprs; //! Number of VGPRs used by the kernel
|
cl_uint numberOfVgprs; //! Number of VGPRs used by the kernel
|
||||||
cl_uint numberOfSgprs; //! Number of SGPRs used by the kernel
|
cl_uint numberOfSgprs; //! Number of SGPRs used by the kernel
|
||||||
size_t sizeOfStaticGroupMemory; //! Static local memory used by the kernel
|
size_t sizeOfStaticGroupMemory; //! Static local memory used by the kernel
|
||||||
} cl_aql_packet_info_amd;
|
} cl_aql_packet_info_amd;
|
||||||
|
|
||||||
/*! \brief Wave address
|
/*! \brief Wave address
|
||||||
*
|
*
|
||||||
* This structure specifies the wave for the SQ control command
|
* This structure specifies the wave for the SQ control command
|
||||||
*/
|
*/
|
||||||
typedef struct _cl_dbg_wave_addr_amd
|
typedef struct _cl_dbg_wave_addr_amd {
|
||||||
{
|
cl_uint shaderEngine : 2; //! Shader engine
|
||||||
cl_uint shaderEngine : 2; //! Shader engine
|
cl_uint shaderArray : 1; //! Shader array
|
||||||
cl_uint shaderArray : 1; //! Shader array
|
cl_uint computeUnit : 4; //! Compute unit
|
||||||
cl_uint computeUnit : 4; //! Compute unit
|
cl_uint simd : 2; //! SIMD id
|
||||||
cl_uint simd : 2; //! SIMD id
|
cl_uint wave : 4; //! Wave id
|
||||||
cl_uint wave : 4; //! Wave id
|
cl_uint vmid : 4; //! VMID
|
||||||
cl_uint vmid : 4; //! VMID
|
cl_uint reserved : 15;
|
||||||
cl_uint reserved : 15;
|
|
||||||
|
|
||||||
} cl_dbg_wave_addr_amd;
|
} cl_dbg_wave_addr_amd;
|
||||||
|
|
||||||
@@ -291,11 +280,9 @@ typedef struct _cl_dbg_wave_addr_amd
|
|||||||
* dispatch. The call back function is to indicate the start of the
|
* dispatch. The call back function is to indicate the start of the
|
||||||
* the kernel launch. It is used by the debugger.
|
* the kernel launch. It is used by the debugger.
|
||||||
*/
|
*/
|
||||||
typedef void * (*cl_PreDispatchCallBackFunctionAMD) ( cl_device_id device,
|
typedef void* (*cl_PreDispatchCallBackFunctionAMD)(cl_device_id device, void* ocl_event_handle,
|
||||||
void *ocl_event_handle,
|
const void* aql_packet, void* acl_binary,
|
||||||
const void *aql_packet,
|
void* user_args);
|
||||||
void *acl_binary,
|
|
||||||
void *user_args);
|
|
||||||
|
|
||||||
/*! \brief Post-dispatch call back function signature
|
/*! \brief Post-dispatch call back function signature
|
||||||
*
|
*
|
||||||
@@ -303,9 +290,8 @@ typedef void * (*cl_PreDispatchCallBackFunctionAMD) ( cl_device_id device,
|
|||||||
* dispatch. The call back function is to indicate the completion of
|
* dispatch. The call back function is to indicate the completion of
|
||||||
* the the kernel launch. It is used by the debugger.
|
* the the kernel launch. It is used by the debugger.
|
||||||
*/
|
*/
|
||||||
typedef void * (*cl_PostDispatchCallBackFunctionAMD) ( cl_device_id device,
|
typedef void* (*cl_PostDispatchCallBackFunctionAMD)(cl_device_id device, cl_ulong event,
|
||||||
cl_ulong event,
|
void* user_args);
|
||||||
void *user_args);
|
|
||||||
|
|
||||||
/*! \brief Set up the dispatch call back function pointers
|
/*! \brief Set up the dispatch call back function pointers
|
||||||
*
|
*
|
||||||
@@ -321,10 +307,9 @@ typedef void * (*cl_PostDispatchCallBackFunctionAMD) ( cl_device_id device,
|
|||||||
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetCallBackFunctionsAMD(
|
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetCallBackFunctionsAMD(
|
||||||
cl_device_id /* device */,
|
cl_device_id /* device */, cl_PreDispatchCallBackFunctionAMD /* preDispatchFunction */,
|
||||||
cl_PreDispatchCallBackFunctionAMD /* preDispatchFunction */,
|
cl_PostDispatchCallBackFunctionAMD /* postDispatchFunction */
|
||||||
cl_PostDispatchCallBackFunctionAMD /* postDispatchFunction */
|
) CL_API_SUFFIX__VERSION_2_0;
|
||||||
) CL_API_SUFFIX__VERSION_2_0;
|
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Set up the arguments of the dispatch call back function
|
/*! \brief Set up the arguments of the dispatch call back function
|
||||||
@@ -340,11 +325,10 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetCallBackFunctionsAMD(
|
|||||||
* - CL_INVALID_DEVICE if the device is not valid
|
* - CL_INVALID_DEVICE if the device is not valid
|
||||||
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetCallBackArgumentsAMD(
|
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetCallBackArgumentsAMD(cl_device_id /* device */,
|
||||||
cl_device_id /* device */,
|
void* /* preDispatchArgs */,
|
||||||
void * /* preDispatchArgs */,
|
void* /* postDispatchArgs */
|
||||||
void * /* postDispatchArgs */
|
) CL_API_SUFFIX__VERSION_2_0;
|
||||||
) CL_API_SUFFIX__VERSION_2_0;
|
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Invalidate all cache on the device.
|
/*! \brief Invalidate all cache on the device.
|
||||||
@@ -358,10 +342,9 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetCallBackArgumentsAMD(
|
|||||||
* - CL_INVALID_DEVICE if the device is not valid
|
* - CL_INVALID_DEVICE if the device is not valid
|
||||||
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgFlushCacheAMD(
|
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgFlushCacheAMD(cl_device_id /* device */,
|
||||||
cl_device_id /* device */,
|
cl_dbg_gpu_cache_mask_amd /* mask */
|
||||||
cl_dbg_gpu_cache_mask_amd /* mask */
|
) CL_API_SUFFIX__VERSION_2_0;
|
||||||
) CL_API_SUFFIX__VERSION_2_0;
|
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Set up an exception policy in the trap handler object
|
/*! \brief Set up an exception policy in the trap handler object
|
||||||
@@ -378,9 +361,8 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgFlushCacheAMD(
|
|||||||
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetExceptionPolicyAMD(
|
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetExceptionPolicyAMD(
|
||||||
cl_device_id /* device */,
|
cl_device_id /* device */, cl_dbg_exception_policy_amd* /* policy */
|
||||||
cl_dbg_exception_policy_amd * /* policy */
|
) CL_API_SUFFIX__VERSION_2_0;
|
||||||
) CL_API_SUFFIX__VERSION_2_0;
|
|
||||||
|
|
||||||
/*! \brief Get the exception policy in the trap handler object
|
/*! \brief Get the exception policy in the trap handler object
|
||||||
*
|
*
|
||||||
@@ -395,9 +377,8 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetExceptionPolicyAMD(
|
|||||||
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgGetExceptionPolicyAMD(
|
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgGetExceptionPolicyAMD(
|
||||||
cl_device_id /* device */,
|
cl_device_id /* device */, cl_dbg_exception_policy_amd* /* policy */
|
||||||
cl_dbg_exception_policy_amd * /* policy */
|
) CL_API_SUFFIX__VERSION_2_0;
|
||||||
) CL_API_SUFFIX__VERSION_2_0;
|
|
||||||
|
|
||||||
/*! \brief Set up the kernel execution mode in the trap handler object
|
/*! \brief Set up the kernel execution mode in the trap handler object
|
||||||
*
|
*
|
||||||
@@ -413,9 +394,8 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgGetExceptionPolicyAMD(
|
|||||||
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetKernelExecutionModeAMD(
|
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetKernelExecutionModeAMD(
|
||||||
cl_device_id /* device */,
|
cl_device_id /* device */, cl_dbg_kernel_exec_mode_amd* /* mode */
|
||||||
cl_dbg_kernel_exec_mode_amd * /* mode */
|
) CL_API_SUFFIX__VERSION_2_0;
|
||||||
) CL_API_SUFFIX__VERSION_2_0;
|
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Get the kernel execution mode in the trap handler object
|
/*! \brief Get the kernel execution mode in the trap handler object
|
||||||
@@ -431,9 +411,8 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetKernelExecutionModeAMD(
|
|||||||
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgGetKernelExecutionModeAMD(
|
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgGetKernelExecutionModeAMD(
|
||||||
cl_device_id /* device */,
|
cl_device_id /* device */, cl_dbg_kernel_exec_mode_amd* /* mode */
|
||||||
cl_dbg_kernel_exec_mode_amd * /* mode */
|
) CL_API_SUFFIX__VERSION_2_0;
|
||||||
) CL_API_SUFFIX__VERSION_2_0;
|
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Create a debug event
|
/*! \brief Create a debug event
|
||||||
@@ -453,12 +432,11 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgGetKernelExecutionModeAMD(
|
|||||||
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
||||||
* - CL_OUT_OF_RESOURCES if fails to create the event
|
* - CL_OUT_OF_RESOURCES if fails to create the event
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgCreateEventAMD(
|
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgCreateEventAMD(cl_device_id /* device */,
|
||||||
cl_device_id /* device */,
|
bool /* autoReset */,
|
||||||
bool /* autoReset */,
|
cl_dbg_event_amd* /* pDebugEvent */,
|
||||||
cl_dbg_event_amd * /* pDebugEvent */,
|
cl_uint* /* pEventId */
|
||||||
cl_uint * /* pEventId */
|
) CL_API_SUFFIX__VERSION_2_0;
|
||||||
) CL_API_SUFFIX__VERSION_2_0;
|
|
||||||
|
|
||||||
/*! \brief Wait for a debug event to be signaled
|
/*! \brief Wait for a debug event to be signaled
|
||||||
*
|
*
|
||||||
@@ -477,12 +455,11 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgCreateEventAMD(
|
|||||||
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
||||||
* - CL_EVENT_TIMEOUT_AMD if timeout occurs
|
* - CL_EVENT_TIMEOUT_AMD if timeout occurs
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgWaitEventAMD(
|
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgWaitEventAMD(cl_device_id /* device */,
|
||||||
cl_device_id /* device */,
|
cl_dbg_event_amd /* pDebugEvent */,
|
||||||
cl_dbg_event_amd /* pDebugEvent */,
|
cl_uint /* pEventId */,
|
||||||
cl_uint /* pEventId */,
|
cl_uint /* timeOut */
|
||||||
cl_uint /* timeOut */
|
) CL_API_SUFFIX__VERSION_2_0;
|
||||||
) CL_API_SUFFIX__VERSION_2_0;
|
|
||||||
|
|
||||||
/*! \brief Destroy a debug event
|
/*! \brief Destroy a debug event
|
||||||
*
|
*
|
||||||
@@ -498,11 +475,10 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgWaitEventAMD(
|
|||||||
* - CL_INVALID_VALUE if the pDebugEvent value is NULL
|
* - CL_INVALID_VALUE if the pDebugEvent value is NULL
|
||||||
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgDestroyEventAMD(
|
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgDestroyEventAMD(cl_device_id /* device */,
|
||||||
cl_device_id /* device */,
|
cl_dbg_event_amd* /* pDebugEvent */,
|
||||||
cl_dbg_event_amd * /* pDebugEvent */,
|
cl_uint* /* pEventId */
|
||||||
cl_uint * /* pEventId */
|
) CL_API_SUFFIX__VERSION_2_0;
|
||||||
) CL_API_SUFFIX__VERSION_2_0;
|
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Register the debugger on a device
|
/*! \brief Register the debugger on a device
|
||||||
@@ -522,10 +498,8 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgDestroyEventAMD(
|
|||||||
* - CL_OUT_OF_RESOURCES if a host queue cannot be created for the debugger
|
* - CL_OUT_OF_RESOURCES if a host queue cannot be created for the debugger
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgRegisterDebuggerAMD(
|
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgRegisterDebuggerAMD(
|
||||||
cl_context /* context */,
|
cl_context /* context */, cl_device_id /* device */, volatile void* /* pMessageStorage */
|
||||||
cl_device_id /* device */,
|
) CL_API_SUFFIX__VERSION_2_0;
|
||||||
volatile void * /* pMessageStorage */
|
|
||||||
) CL_API_SUFFIX__VERSION_2_0;
|
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Unregister the debugger on a device
|
/*! \brief Unregister the debugger on a device
|
||||||
@@ -537,9 +511,8 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgRegisterDebuggerAMD(
|
|||||||
* - CL_INVALID_DEVICE if the device is not valid
|
* - CL_INVALID_DEVICE if the device is not valid
|
||||||
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgUnregisterDebuggerAMD(
|
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgUnregisterDebuggerAMD(cl_device_id /* device */
|
||||||
cl_device_id /* device */
|
) CL_API_SUFFIX__VERSION_2_0;
|
||||||
) CL_API_SUFFIX__VERSION_2_0;
|
|
||||||
|
|
||||||
/*! \brief Setup the pointer of the acl_binary to be used by the debugger
|
/*! \brief Setup the pointer of the acl_binary to be used by the debugger
|
||||||
*
|
*
|
||||||
@@ -553,10 +526,9 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgUnregisterDebuggerAMD(
|
|||||||
* - CL_INVALID_VALUE if the aclBinary is not provided
|
* - CL_INVALID_VALUE if the aclBinary is not provided
|
||||||
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetAclBinaryAMD(
|
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetAclBinaryAMD(cl_device_id /* device */,
|
||||||
cl_device_id /* device */,
|
void* /* aclBinary */
|
||||||
void * /* aclBinary */
|
) CL_API_SUFFIX__VERSION_2_0;
|
||||||
) CL_API_SUFFIX__VERSION_2_0;
|
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Control the execution of wavefront on the GPU
|
/*! \brief Control the execution of wavefront on the GPU
|
||||||
@@ -577,13 +549,12 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetAclBinaryAMD(
|
|||||||
* - CL_INVALID_VALUE if the waveMsg is not provided, invalid action or mode value
|
* - CL_INVALID_VALUE if the waveMsg is not provided, invalid action or mode value
|
||||||
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgWaveControlAMD(
|
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgWaveControlAMD(cl_device_id /* device */,
|
||||||
cl_device_id /* device */,
|
cl_dbg_waves_action_amd /* action */,
|
||||||
cl_dbg_waves_action_amd /* action */,
|
cl_dbg_wave_mode_amd /* mode */,
|
||||||
cl_dbg_wave_mode_amd /* mode */,
|
cl_uint /* trapId */,
|
||||||
cl_uint /* trapId */,
|
cl_dbg_wave_addr_amd /* waveAddress */
|
||||||
cl_dbg_wave_addr_amd /* waveAddress */
|
) CL_API_SUFFIX__VERSION_2_0;
|
||||||
) CL_API_SUFFIX__VERSION_2_0;
|
|
||||||
|
|
||||||
/*! \brief Set watch points on memory address ranges to generate exception events
|
/*! \brief Set watch points on memory address ranges to generate exception events
|
||||||
*
|
*
|
||||||
@@ -606,13 +577,10 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgWaveControlAMD(
|
|||||||
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgAddressWatchAMD(
|
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgAddressWatchAMD(
|
||||||
cl_device_id /* device */,
|
cl_device_id /* device */, cl_uint /* numWatchPoints */,
|
||||||
cl_uint /* numWatchPoints */,
|
cl_dbg_address_watch_mode_amd* /* watchMode */, void** /* watchAddress */,
|
||||||
cl_dbg_address_watch_mode_amd * /* watchMode */,
|
cl_ulong* /* watchMask */, cl_dbg_event_amd* /* watchEvent */
|
||||||
void ** /* watchAddress */,
|
) CL_API_SUFFIX__VERSION_2_0;
|
||||||
cl_ulong * /* watchMask */,
|
|
||||||
cl_dbg_event_amd * /* watchEvent */
|
|
||||||
) CL_API_SUFFIX__VERSION_2_0;
|
|
||||||
|
|
||||||
/*! \brief Get the packaet information for kernel execution
|
/*! \brief Get the packaet information for kernel execution
|
||||||
*
|
*
|
||||||
@@ -628,10 +596,9 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgAddressWatchAMD(
|
|||||||
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgGetAqlPacketInfoAMD(
|
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgGetAqlPacketInfoAMD(
|
||||||
cl_device_id /* device */,
|
cl_device_id /* device */, const void* /* aqlCodeInfo */,
|
||||||
const void * /* aqlCodeInfo */,
|
cl_aql_packet_info_amd* /* packetInfo */
|
||||||
cl_aql_packet_info_amd * /* packetInfo */
|
) CL_API_SUFFIX__VERSION_2_0;
|
||||||
) CL_API_SUFFIX__VERSION_2_0;
|
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Get the dispatch debug information
|
/*! \brief Get the dispatch debug information
|
||||||
@@ -646,16 +613,16 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgGetAqlPacketInfoAMD(
|
|||||||
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgGetDispatchDebugInfoAMD(
|
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgGetDispatchDebugInfoAMD(
|
||||||
cl_device_id /* device */,
|
cl_device_id /* device */, cl_dispatch_debug_info_amd* /* debugInfo */
|
||||||
cl_dispatch_debug_info_amd * /* debugInfo */
|
) CL_API_SUFFIX__VERSION_2_0;
|
||||||
) CL_API_SUFFIX__VERSION_2_0;
|
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Map the video memory for the kernel code to allow host access
|
/*! \brief Map the video memory for the kernel code to allow host access
|
||||||
*
|
*
|
||||||
* \param device specifies the device to be used
|
* \param device specifies the device to be used
|
||||||
*
|
*
|
||||||
* \param aqlCodeAddress is the memory points to the returned host memory address for the kernel code
|
* \param aqlCodeAddress is the memory points to the returned host memory address for the kernel
|
||||||
|
* code
|
||||||
*
|
*
|
||||||
* \param aqlCodeSize returns the size of the kernel code
|
* \param aqlCodeSize returns the size of the kernel code
|
||||||
*
|
*
|
||||||
@@ -664,10 +631,9 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgGetDispatchDebugInfoAMD(
|
|||||||
* - CL_INVALID_DEVICE if the device is not valid
|
* - CL_INVALID_DEVICE if the device is not valid
|
||||||
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgMapKernelCodeAMD(
|
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgMapKernelCodeAMD(cl_device_id /* device */,
|
||||||
cl_device_id /* device */,
|
void* /* aqlCodeInfo */
|
||||||
void * /* aqlCodeInfo */
|
) CL_API_SUFFIX__VERSION_2_0;
|
||||||
) CL_API_SUFFIX__VERSION_2_0;
|
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Unmap the video memory for the kernel code
|
/*! \brief Unmap the video memory for the kernel code
|
||||||
@@ -681,17 +647,17 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgMapKernelCodeAMD(
|
|||||||
* - CL_INVALID_DEVICE if the device is not valid
|
* - CL_INVALID_DEVICE if the device is not valid
|
||||||
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgUnmapKernelCodeAMD(
|
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgUnmapKernelCodeAMD(cl_device_id /* device */,
|
||||||
cl_device_id /* device */,
|
cl_ulong* /* aqlCodeAddress */
|
||||||
cl_ulong * /* aqlCodeAddress */
|
) CL_API_SUFFIX__VERSION_2_0;
|
||||||
) CL_API_SUFFIX__VERSION_2_0;
|
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Map the shader scratch ring's video memory to allow CPU access
|
/*! \brief Map the shader scratch ring's video memory to allow CPU access
|
||||||
*
|
*
|
||||||
* \param device specifies the device to be used
|
* \param device specifies the device to be used
|
||||||
*
|
*
|
||||||
* \param scratchRingAddr is the memory points to the returned host memory address for scratch ring
|
* \param scratchRingAddr is the memory points to the returned host memory address for scratch
|
||||||
|
* ring
|
||||||
*
|
*
|
||||||
* \param scratchRingSize returns the size of the scratch ring
|
* \param scratchRingSize returns the size of the scratch ring
|
||||||
*
|
*
|
||||||
@@ -700,11 +666,10 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgUnmapKernelCodeAMD(
|
|||||||
* - CL_INVALID_DEVICE if the device is not valid
|
* - CL_INVALID_DEVICE if the device is not valid
|
||||||
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgMapScratchRingAMD(
|
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgMapScratchRingAMD(cl_device_id /* device */,
|
||||||
cl_device_id /* device */,
|
cl_ulong* /* scratchRingAddr */,
|
||||||
cl_ulong * /* scratchRingAddr */,
|
cl_uint* /* scratchRingSize */
|
||||||
cl_uint * /* scratchRingSize */
|
) CL_API_SUFFIX__VERSION_2_0;
|
||||||
) CL_API_SUFFIX__VERSION_2_0;
|
|
||||||
|
|
||||||
/*! \brief Unmap the shader scratch ring's video memory
|
/*! \brief Unmap the shader scratch ring's video memory
|
||||||
*
|
*
|
||||||
@@ -717,10 +682,9 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgMapScratchRingAMD(
|
|||||||
* - CL_INVALID_DEVICE if the device is not valid
|
* - CL_INVALID_DEVICE if the device is not valid
|
||||||
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgUnmapScratchRingAMD(
|
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgUnmapScratchRingAMD(cl_device_id /* device */,
|
||||||
cl_device_id /* device */,
|
cl_ulong* /* scratchRingAddr */
|
||||||
cl_ulong * /* scratchRingAddr */
|
) CL_API_SUFFIX__VERSION_2_0;
|
||||||
) CL_API_SUFFIX__VERSION_2_0;
|
|
||||||
|
|
||||||
/*! \brief Get the memory object associated with the kernel parameter
|
/*! \brief Get the memory object associated with the kernel parameter
|
||||||
*
|
*
|
||||||
@@ -737,11 +701,10 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgUnmapScratchRingAMD(
|
|||||||
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
||||||
* - CL_INVALID_KERNEL_ARGS if it fails to get the memory object for the kernel argument
|
* - CL_INVALID_KERNEL_ARGS if it fails to get the memory object for the kernel argument
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgGetKernelParamMemAMD(
|
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgGetKernelParamMemAMD(cl_device_id /* devicepointer */,
|
||||||
cl_device_id /* devicepointer */,
|
cl_uint /* paramIdx */,
|
||||||
cl_uint /* paramIdx */,
|
cl_mem* /* paramMem */
|
||||||
cl_mem * /* paramMem */
|
) CL_API_SUFFIX__VERSION_2_0;
|
||||||
) CL_API_SUFFIX__VERSION_2_0;
|
|
||||||
|
|
||||||
/*! \brief Set value of a global memory object
|
/*! \brief Set value of a global memory object
|
||||||
*
|
*
|
||||||
@@ -761,13 +724,12 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgGetKernelParamMemAMD(
|
|||||||
* - CL_INVALID_VALUE if memObj or srcPtr has NULL value, size <= 0 or offset < 0
|
* - CL_INVALID_VALUE if memObj or srcPtr has NULL value, size <= 0 or offset < 0
|
||||||
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetGlobalMemoryAMD(
|
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetGlobalMemoryAMD(cl_device_id /* device */,
|
||||||
cl_device_id /* device */,
|
cl_mem /* memObject */,
|
||||||
cl_mem /* memObject */,
|
cl_uint /* offset */,
|
||||||
cl_uint /* offset */,
|
void* /* srcMem */,
|
||||||
void * /* srcMem */,
|
cl_uint /* size */
|
||||||
cl_uint /* size */
|
) CL_API_SUFFIX__VERSION_2_0;
|
||||||
) CL_API_SUFFIX__VERSION_2_0;
|
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Install the trap handler of a given type
|
/*! \brief Install the trap handler of a given type
|
||||||
@@ -790,17 +752,15 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetGlobalMemoryAMD(
|
|||||||
* - CL_INVALID_VALUE if trapHandler is NULL or trapHandlerSize <= 0
|
* - CL_INVALID_VALUE if trapHandler is NULL or trapHandlerSize <= 0
|
||||||
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgInstallTrapAMD(
|
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgInstallTrapAMD(cl_device_id /* device */,
|
||||||
cl_device_id /* device */,
|
cl_dbg_trap_type_amd /* trapType */,
|
||||||
cl_dbg_trap_type_amd /* trapType */,
|
cl_mem /* trapHandler */,
|
||||||
cl_mem /* trapHandler */,
|
cl_mem /* trapBuffer */
|
||||||
cl_mem /* trapBuffer */
|
) CL_API_SUFFIX__VERSION_2_0;
|
||||||
) CL_API_SUFFIX__VERSION_2_0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /*extern "C"*/
|
} /*extern "C"*/
|
||||||
#endif /*__cplusplus*/
|
#endif /*__cplusplus*/
|
||||||
|
|
||||||
#endif /*__CL_DEBUGGER_AMD_H*/
|
#endif /*__CL_DEBUGGER_AMD_H*/
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -62,45 +62,41 @@
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clWaitForEvents, (
|
RUNTIME_ENTRY(cl_int, clWaitForEvents, (cl_uint num_events, const cl_event* event_list)) {
|
||||||
cl_uint num_events,
|
if (num_events == 0 || event_list == NULL) {
|
||||||
const cl_event *event_list))
|
return CL_INVALID_VALUE;
|
||||||
{
|
}
|
||||||
if (num_events == 0 || event_list == NULL) {
|
|
||||||
return CL_INVALID_VALUE;
|
const amd::Context* prevContext = NULL;
|
||||||
|
const amd::HostQueue* prevQueue = NULL;
|
||||||
|
|
||||||
|
for (cl_uint i = 0; i < num_events; ++i) {
|
||||||
|
cl_event event = event_list[i];
|
||||||
|
|
||||||
|
if (!is_valid(event)) {
|
||||||
|
return CL_INVALID_EVENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
const amd::Context* prevContext = NULL;
|
// Make sure all the events are associated with the same context
|
||||||
const amd::HostQueue* prevQueue = NULL;
|
const amd::Context* context = &as_amd(event)->context();
|
||||||
|
if (prevContext != NULL && prevContext != context) {
|
||||||
for (cl_uint i = 0; i < num_events; ++i) {
|
return CL_INVALID_CONTEXT;
|
||||||
cl_event event = event_list[i];
|
|
||||||
|
|
||||||
if (!is_valid(event)) {
|
|
||||||
return CL_INVALID_EVENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure all the events are associated with the same context
|
|
||||||
const amd::Context* context = &as_amd(event)->context();
|
|
||||||
if (prevContext != NULL && prevContext != context) {
|
|
||||||
return CL_INVALID_CONTEXT;
|
|
||||||
}
|
|
||||||
prevContext = context;
|
|
||||||
|
|
||||||
// Flush the command queues associated with event1...eventN
|
|
||||||
amd::HostQueue* queue = as_amd(event)->command().queue();
|
|
||||||
if (queue != NULL && prevQueue != queue) {
|
|
||||||
queue->flush();
|
|
||||||
}
|
|
||||||
prevQueue = queue;
|
|
||||||
}
|
}
|
||||||
|
prevContext = context;
|
||||||
|
|
||||||
bool allSucceeded = true;
|
// Flush the command queues associated with event1...eventN
|
||||||
while (num_events-- > 0) {
|
amd::HostQueue* queue = as_amd(event)->command().queue();
|
||||||
allSucceeded &= as_amd(*event_list++)->awaitCompletion();
|
if (queue != NULL && prevQueue != queue) {
|
||||||
|
queue->flush();
|
||||||
}
|
}
|
||||||
return allSucceeded ? CL_SUCCESS
|
prevQueue = queue;
|
||||||
: CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST;
|
}
|
||||||
|
|
||||||
|
bool allSucceeded = true;
|
||||||
|
while (num_events-- > 0) {
|
||||||
|
allSucceeded &= as_amd(*event_list++)->awaitCompletion();
|
||||||
|
}
|
||||||
|
return allSucceeded ? CL_SUCCESS : CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -134,52 +130,44 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clGetEventInfo, (
|
RUNTIME_ENTRY(cl_int, clGetEventInfo,
|
||||||
cl_event event,
|
(cl_event event, cl_event_info param_name, size_t param_value_size, void* param_value,
|
||||||
cl_event_info param_name,
|
size_t* param_value_size_ret)) {
|
||||||
size_t param_value_size,
|
if (!is_valid(event)) {
|
||||||
void *param_value,
|
return CL_INVALID_EVENT;
|
||||||
size_t *param_value_size_ret))
|
}
|
||||||
{
|
|
||||||
if (!is_valid(event)) {
|
|
||||||
return CL_INVALID_EVENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(param_name) {
|
switch (param_name) {
|
||||||
case CL_EVENT_CONTEXT: {
|
case CL_EVENT_CONTEXT: {
|
||||||
amd::Context& amdCtx = const_cast<amd::Context&>(as_amd(event)->context());
|
amd::Context& amdCtx = const_cast<amd::Context&>(as_amd(event)->context());
|
||||||
cl_context context = as_cl(&amdCtx);
|
cl_context context = as_cl(&amdCtx);
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(context, param_value_size, param_value, param_value_size_ret);
|
||||||
context, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
case CL_EVENT_COMMAND_QUEUE: {
|
case CL_EVENT_COMMAND_QUEUE: {
|
||||||
amd::Command& command = as_amd(event)->command();
|
amd::Command& command = as_amd(event)->command();
|
||||||
cl_command_queue queue = command.queue() == NULL
|
cl_command_queue queue = command.queue() == NULL
|
||||||
? NULL : const_cast<cl_command_queue>(as_cl(command.queue()->asCommandQueue()));
|
? NULL
|
||||||
return amd::clGetInfo(
|
: const_cast<cl_command_queue>(as_cl(command.queue()->asCommandQueue()));
|
||||||
queue, param_value_size, param_value, param_value_size_ret);
|
return amd::clGetInfo(queue, param_value_size, param_value, param_value_size_ret);
|
||||||
}
|
}
|
||||||
case CL_EVENT_COMMAND_TYPE: {
|
case CL_EVENT_COMMAND_TYPE: {
|
||||||
cl_command_type type = as_amd(event)->command().type();
|
cl_command_type type = as_amd(event)->command().type();
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(type, param_value_size, param_value, param_value_size_ret);
|
||||||
type, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
case CL_EVENT_COMMAND_EXECUTION_STATUS: {
|
case CL_EVENT_COMMAND_EXECUTION_STATUS: {
|
||||||
as_amd(event)->notifyCmdQueue();
|
as_amd(event)->notifyCmdQueue();
|
||||||
cl_int status = as_amd(event)->command().status();
|
cl_int status = as_amd(event)->command().status();
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(status, param_value_size, param_value, param_value_size_ret);
|
||||||
status, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
case CL_EVENT_REFERENCE_COUNT: {
|
case CL_EVENT_REFERENCE_COUNT: {
|
||||||
cl_uint count = as_amd(event)->referenceCount();
|
cl_uint count = as_amd(event)->referenceCount();
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(count, param_value_size, param_value, param_value_size_ret);
|
||||||
count, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -192,13 +180,12 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clRetainEvent, (cl_event event))
|
RUNTIME_ENTRY(cl_int, clRetainEvent, (cl_event event)) {
|
||||||
{
|
if (!is_valid(event)) {
|
||||||
if (!is_valid(event)) {
|
return CL_INVALID_EVENT;
|
||||||
return CL_INVALID_EVENT;
|
}
|
||||||
}
|
as_amd(event)->retain();
|
||||||
as_amd(event)->retain();
|
return CL_SUCCESS;
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -214,13 +201,12 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clReleaseEvent, (cl_event event))
|
RUNTIME_ENTRY(cl_int, clReleaseEvent, (cl_event event)) {
|
||||||
{
|
if (!is_valid(event)) {
|
||||||
if (!is_valid(event)) {
|
return CL_INVALID_EVENT;
|
||||||
return CL_INVALID_EVENT;
|
}
|
||||||
}
|
as_amd(event)->release();
|
||||||
as_amd(event)->release();
|
return CL_SUCCESS;
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -240,24 +226,21 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.1r15
|
* \version 1.1r15
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY_RET(cl_event, clCreateUserEvent, (
|
RUNTIME_ENTRY_RET(cl_event, clCreateUserEvent, (cl_context context, cl_int* errcode_ret)) {
|
||||||
cl_context context,
|
if (!is_valid(context)) {
|
||||||
cl_int *errcode_ret))
|
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
|
||||||
{
|
return (cl_event)0;
|
||||||
if (!is_valid(context)) {
|
}
|
||||||
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
|
|
||||||
return (cl_event) 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::Event* event = new amd::UserEvent(*as_amd(context));
|
amd::Event* event = new amd::UserEvent(*as_amd(context));
|
||||||
if (event == NULL) {
|
if (event == NULL) {
|
||||||
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
|
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
|
||||||
return (cl_event) 0;
|
return (cl_event)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
event->retain();
|
event->retain();
|
||||||
*not_null(errcode_ret) = CL_SUCCESS;
|
*not_null(errcode_ret) = CL_SUCCESS;
|
||||||
return as_cl(event);
|
return as_cl(event);
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -279,21 +262,18 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.1r15
|
* \version 1.1r15
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clSetUserEventStatus, (
|
RUNTIME_ENTRY(cl_int, clSetUserEventStatus, (cl_event event, cl_int execution_status)) {
|
||||||
cl_event event,
|
if (!is_valid(event)) {
|
||||||
cl_int execution_status))
|
return CL_INVALID_EVENT;
|
||||||
{
|
}
|
||||||
if (!is_valid(event)) {
|
if (execution_status > CL_COMPLETE) {
|
||||||
return CL_INVALID_EVENT;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
if (execution_status > CL_COMPLETE) {
|
|
||||||
return CL_INVALID_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!as_amd(event)->setStatus(execution_status)) {
|
if (!as_amd(event)->setStatus(execution_status)) {
|
||||||
return CL_INVALID_OPERATION;
|
return CL_INVALID_OPERATION;
|
||||||
}
|
}
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -362,35 +342,30 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.1r15
|
* \version 1.1r15
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clSetEventCallback, (
|
RUNTIME_ENTRY(cl_int, clSetEventCallback,
|
||||||
cl_event event,
|
(cl_event event, cl_int command_exec_callback_type,
|
||||||
cl_int command_exec_callback_type,
|
void(CL_CALLBACK* pfn_notify)(cl_event event, cl_int command_exec_status,
|
||||||
void (CL_CALLBACK * pfn_notify)(
|
void* user_data),
|
||||||
cl_event event, cl_int command_exec_status, void *user_data),
|
void* user_data)) {
|
||||||
void* user_data))
|
if (!is_valid(event)) {
|
||||||
{
|
return CL_INVALID_EVENT;
|
||||||
if (!is_valid(event)) {
|
}
|
||||||
return CL_INVALID_EVENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pfn_notify == NULL
|
if (pfn_notify == NULL || command_exec_callback_type < CL_COMPLETE ||
|
||||||
|| command_exec_callback_type < CL_COMPLETE
|
command_exec_callback_type > CL_QUEUED) {
|
||||||
|| command_exec_callback_type > CL_QUEUED) {
|
return CL_INVALID_VALUE;
|
||||||
return CL_INVALID_VALUE;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!as_amd(event)->setCallback(
|
if (!as_amd(event)->setCallback(command_exec_callback_type, pfn_notify, user_data)) {
|
||||||
command_exec_callback_type, pfn_notify, user_data)) {
|
return CL_OUT_OF_HOST_MEMORY;
|
||||||
return CL_OUT_OF_HOST_MEMORY;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
as_amd(event)->notifyCmdQueue();
|
as_amd(event)->notifyCmdQueue();
|
||||||
|
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
/*! @}
|
/*! @}
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -150,144 +150,134 @@
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clEnqueueNDRangeKernel, (
|
RUNTIME_ENTRY(cl_int, clEnqueueNDRangeKernel,
|
||||||
cl_command_queue command_queue,
|
(cl_command_queue command_queue, cl_kernel kernel, cl_uint work_dim,
|
||||||
cl_kernel kernel,
|
const size_t* global_work_offset, const size_t* global_work_size,
|
||||||
cl_uint work_dim,
|
const size_t* local_work_size, cl_uint num_events_in_wait_list,
|
||||||
const size_t *global_work_offset,
|
const cl_event* event_wait_list, cl_event* event)) {
|
||||||
const size_t *global_work_size,
|
*not_null(event) = NULL;
|
||||||
const size_t *local_work_size,
|
|
||||||
cl_uint num_events_in_wait_list,
|
|
||||||
const cl_event *event_wait_list,
|
|
||||||
cl_event *event))
|
|
||||||
{
|
|
||||||
*not_null(event) = NULL;
|
|
||||||
|
|
||||||
if (!is_valid(command_queue)) {
|
if (!is_valid(command_queue)) {
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
}
|
}
|
||||||
if (!is_valid(kernel)) {
|
if (!is_valid(kernel)) {
|
||||||
return CL_INVALID_KERNEL;
|
return CL_INVALID_KERNEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
amd::HostQueue* queue = as_amd(command_queue)->asHostQueue();
|
amd::HostQueue* queue = as_amd(command_queue)->asHostQueue();
|
||||||
if (NULL == queue) {
|
if (NULL == queue) {
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
}
|
}
|
||||||
amd::HostQueue& hostQueue = *queue;
|
amd::HostQueue& hostQueue = *queue;
|
||||||
|
|
||||||
const amd::Kernel* amdKernel = as_amd(kernel);
|
const amd::Kernel* amdKernel = as_amd(kernel);
|
||||||
if (&hostQueue.context() != &amdKernel->program().context()) {
|
if (&hostQueue.context() != &amdKernel->program().context()) {
|
||||||
return CL_INVALID_CONTEXT;
|
return CL_INVALID_CONTEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
const amd::Device& device = hostQueue.device();
|
const amd::Device& device = hostQueue.device();
|
||||||
const device::Kernel* devKernel = amdKernel->getDeviceKernel(device);
|
const device::Kernel* devKernel = amdKernel->getDeviceKernel(device);
|
||||||
if (devKernel == NULL) {
|
if (devKernel == NULL) {
|
||||||
return CL_INVALID_PROGRAM_EXECUTABLE;
|
return CL_INVALID_PROGRAM_EXECUTABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (amdKernel->parameters().getSvmSystemPointersSupport() == FGS_YES &&
|
if (amdKernel->parameters().getSvmSystemPointersSupport() == FGS_YES &&
|
||||||
!(device.info().svmCapabilities_ & CL_DEVICE_SVM_FINE_GRAIN_SYSTEM)) {
|
!(device.info().svmCapabilities_ & CL_DEVICE_SVM_FINE_GRAIN_SYSTEM)) {
|
||||||
// The user indicated that this kernel will access SVM system pointers,
|
// The user indicated that this kernel will access SVM system pointers,
|
||||||
// but the device does not support them.
|
// but the device does not support them.
|
||||||
return CL_INVALID_OPERATION;
|
return CL_INVALID_OPERATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (work_dim < 1 || work_dim > 3) {
|
if (work_dim < 1 || work_dim > 3) {
|
||||||
return CL_INVALID_WORK_DIMENSION;
|
return CL_INVALID_WORK_DIMENSION;
|
||||||
}
|
}
|
||||||
#if !defined(CL_VERSION_1_1)
|
#if !defined(CL_VERSION_1_1)
|
||||||
if (global_work_offset != NULL) {
|
if (global_work_offset != NULL) {
|
||||||
return CL_INVALID_GLOBAL_OFFSET;
|
return CL_INVALID_GLOBAL_OFFSET;
|
||||||
}
|
}
|
||||||
#endif // CL_VERSION
|
#endif // CL_VERSION
|
||||||
if (global_work_size == NULL) {
|
if (global_work_size == NULL) {
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
} else {
|
||||||
else {
|
// >32bits global work size is not supported.
|
||||||
// >32bits global work size is not supported.
|
for (cl_uint dim = 0; dim < work_dim; ++dim) {
|
||||||
for (cl_uint dim = 0; dim < work_dim; ++dim) {
|
if (global_work_size[dim] > static_cast<size_t>(0xffffffff)) {
|
||||||
if (global_work_size[dim] > static_cast<size_t>(0xffffffff)) {
|
return CL_INVALID_GLOBAL_WORK_SIZE;
|
||||||
return CL_INVALID_GLOBAL_WORK_SIZE;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (local_work_size == NULL) {
|
if (local_work_size == NULL) {
|
||||||
static size_t zeroes[3] = { 0, 0, 0 };
|
static size_t zeroes[3] = {0, 0, 0};
|
||||||
local_work_size = zeroes;
|
local_work_size = zeroes;
|
||||||
|
} else {
|
||||||
|
size_t numWorkItems = 1;
|
||||||
|
for (cl_uint dim = 0; dim < work_dim; ++dim) {
|
||||||
|
if (local_work_size[dim] == 0 ||
|
||||||
|
local_work_size[dim] > device.info().maxWorkItemSizes_[dim]) {
|
||||||
|
return CL_INVALID_WORK_ITEM_SIZE;
|
||||||
|
}
|
||||||
|
if ((local_work_size[dim] != 0) && (devKernel->workGroupInfo()->compileSize_[0] != 0) &&
|
||||||
|
(local_work_size[dim] != devKernel->workGroupInfo()->compileSize_[dim])) {
|
||||||
|
return CL_INVALID_WORK_GROUP_SIZE;
|
||||||
|
}
|
||||||
|
if ((global_work_size[dim] == 0) || (((global_work_size[dim] % local_work_size[dim]) != 0) &&
|
||||||
|
(!device.settings().partialDispatch_ ||
|
||||||
|
devKernel->workGroupInfo()->uniformWorkGroupSize_))) {
|
||||||
|
return CL_INVALID_WORK_GROUP_SIZE;
|
||||||
|
}
|
||||||
|
numWorkItems *= local_work_size[dim];
|
||||||
}
|
}
|
||||||
else {
|
if (numWorkItems > devKernel->workGroupInfo()->size_) {
|
||||||
size_t numWorkItems = 1;
|
return CL_INVALID_WORK_GROUP_SIZE;
|
||||||
for (cl_uint dim = 0; dim < work_dim; ++dim) {
|
|
||||||
if (local_work_size[dim] == 0 || local_work_size[dim]
|
|
||||||
> device.info().maxWorkItemSizes_[dim]) {
|
|
||||||
return CL_INVALID_WORK_ITEM_SIZE;
|
|
||||||
}
|
|
||||||
if ((local_work_size[dim] != 0) &&
|
|
||||||
(devKernel->workGroupInfo()->compileSize_[0] != 0) && (local_work_size[dim] !=
|
|
||||||
devKernel->workGroupInfo()->compileSize_[dim])) {
|
|
||||||
return CL_INVALID_WORK_GROUP_SIZE;
|
|
||||||
}
|
|
||||||
if ((global_work_size[dim] == 0) ||
|
|
||||||
(((global_work_size[dim] % local_work_size[dim]) != 0) &&
|
|
||||||
(!device.settings().partialDispatch_ ||
|
|
||||||
devKernel->workGroupInfo()->uniformWorkGroupSize_))) {
|
|
||||||
return CL_INVALID_WORK_GROUP_SIZE;
|
|
||||||
}
|
|
||||||
numWorkItems *= local_work_size[dim];
|
|
||||||
}
|
|
||||||
if (numWorkItems > devKernel->workGroupInfo()->size_) {
|
|
||||||
return CL_INVALID_WORK_GROUP_SIZE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check that all parameters have been defined.
|
// Check that all parameters have been defined.
|
||||||
if (!amdKernel->parameters().check()) {
|
if (!amdKernel->parameters().check()) {
|
||||||
return CL_INVALID_KERNEL_ARGS;
|
return CL_INVALID_KERNEL_ARGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that we do not exceed the amount of available local memory.
|
// Check that we do not exceed the amount of available local memory.
|
||||||
const size_t align = device.info().minDataTypeAlignSize_;
|
const size_t align = device.info().minDataTypeAlignSize_;
|
||||||
cl_ulong requiredLocalMemSize =
|
cl_ulong requiredLocalMemSize =
|
||||||
static_cast<cl_ulong>(amdKernel->parameters().localMemSize(align)) +
|
static_cast<cl_ulong>(amdKernel->parameters().localMemSize(align)) +
|
||||||
amd::alignUp(devKernel->workGroupInfo()->localMemSize_, align);
|
amd::alignUp(devKernel->workGroupInfo()->localMemSize_, align);
|
||||||
|
|
||||||
if (requiredLocalMemSize > device.info().localMemSize_) {
|
if (requiredLocalMemSize > device.info().localMemSize_) {
|
||||||
return CL_OUT_OF_RESOURCES;
|
return CL_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
amd::Command::EventWaitList eventWaitList;
|
amd::Command::EventWaitList eventWaitList;
|
||||||
cl_int err = amd::clSetEventWaitList(eventWaitList,
|
cl_int err = amd::clSetEventWaitList(eventWaitList, hostQueue.context(), num_events_in_wait_list,
|
||||||
hostQueue.context(), num_events_in_wait_list, event_wait_list);
|
event_wait_list);
|
||||||
if (err != CL_SUCCESS) {
|
if (err != CL_SUCCESS) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
amd::NDRangeContainer ndrange((size_t) work_dim,
|
amd::NDRangeContainer ndrange((size_t)work_dim, global_work_offset, global_work_size,
|
||||||
global_work_offset, global_work_size, local_work_size);
|
local_work_size);
|
||||||
amd::NDRangeKernelCommand* command = new amd::NDRangeKernelCommand(
|
amd::NDRangeKernelCommand* command =
|
||||||
hostQueue, eventWaitList, *as_amd(kernel), ndrange);
|
new amd::NDRangeKernelCommand(hostQueue, eventWaitList, *as_amd(kernel), ndrange);
|
||||||
if (command == NULL) {
|
if (command == NULL) {
|
||||||
return CL_OUT_OF_HOST_MEMORY;
|
return CL_OUT_OF_HOST_MEMORY;
|
||||||
}
|
}
|
||||||
// ndrange is now owned by command. Do not delete it!
|
// ndrange is now owned by command. Do not delete it!
|
||||||
|
|
||||||
// Make sure we have memory for the command execution
|
// Make sure we have memory for the command execution
|
||||||
cl_int result = command->validateMemory();
|
cl_int result = command->validateMemory();
|
||||||
if (result != CL_SUCCESS) {
|
if (result != CL_SUCCESS) {
|
||||||
delete command;
|
delete command;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
command->enqueue();
|
command->enqueue();
|
||||||
|
|
||||||
*not_null(event) = as_cl(&command->event());
|
*not_null(event) = as_cl(&command->event());
|
||||||
if (event == NULL) {
|
if (event == NULL) {
|
||||||
command->release();
|
command->release();
|
||||||
}
|
}
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -352,28 +342,24 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clEnqueueTask, (
|
RUNTIME_ENTRY(cl_int, clEnqueueTask,
|
||||||
cl_command_queue command_queue,
|
(cl_command_queue command_queue, cl_kernel kernel, cl_uint num_events_in_wait_list,
|
||||||
cl_kernel kernel,
|
const cl_event* event_wait_list, cl_event* event)) {
|
||||||
cl_uint num_events_in_wait_list,
|
static size_t const globalWorkSize[3] = {1, 0, 0};
|
||||||
const cl_event *event_wait_list,
|
static size_t const localWorkSize[3] = {1, 0, 0};
|
||||||
cl_event *event))
|
|
||||||
{
|
|
||||||
static size_t const globalWorkSize[3] = {1, 0, 0};
|
|
||||||
static size_t const localWorkSize[3] = {1, 0, 0};
|
|
||||||
|
|
||||||
if (!is_valid(command_queue)) {
|
if (!is_valid(command_queue)) {
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
||||||
if (NULL == hostQueue) {
|
if (NULL == hostQueue) {
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hostQueue->dispatch_->clEnqueueNDRangeKernel(
|
return hostQueue->dispatch_->clEnqueueNDRangeKernel(
|
||||||
command_queue, kernel, 1, NULL, globalWorkSize, localWorkSize,
|
command_queue, kernel, 1, NULL, globalWorkSize, localWorkSize, num_events_in_wait_list,
|
||||||
num_events_in_wait_list, event_wait_list, event);
|
event_wait_list, event);
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -442,72 +428,62 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clEnqueueNativeKernel, (
|
RUNTIME_ENTRY(cl_int, clEnqueueNativeKernel,
|
||||||
cl_command_queue command_queue,
|
(cl_command_queue command_queue, void(CL_CALLBACK* user_func)(void*), void* args,
|
||||||
void (CL_CALLBACK * user_func)(void *),
|
size_t cb_args, cl_uint num_mem_objects, const cl_mem* mem_list,
|
||||||
void *args,
|
const void** args_mem_loc, cl_uint num_events_in_wait_list,
|
||||||
size_t cb_args,
|
const cl_event* event_wait_list, cl_event* event)) {
|
||||||
cl_uint num_mem_objects,
|
*not_null(event) = NULL;
|
||||||
const cl_mem *mem_list,
|
|
||||||
const void **args_mem_loc,
|
|
||||||
cl_uint num_events_in_wait_list,
|
|
||||||
const cl_event *event_wait_list,
|
|
||||||
cl_event *event))
|
|
||||||
{
|
|
||||||
*not_null(event) = NULL;
|
|
||||||
|
|
||||||
if (!is_valid(command_queue)) {
|
if (!is_valid(command_queue)) {
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
amd::HostQueue* queue = as_amd(command_queue)->asHostQueue();
|
||||||
|
if (NULL == queue) {
|
||||||
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
|
}
|
||||||
|
amd::HostQueue& hostQueue = *queue;
|
||||||
|
|
||||||
|
const amd::Device& device = hostQueue.device();
|
||||||
|
|
||||||
|
if (!(device.info().executionCapabilities_ & CL_EXEC_NATIVE_KERNEL)) {
|
||||||
|
return CL_INVALID_OPERATION;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (user_func == NULL || (num_mem_objects > 0 && (mem_list == NULL || args_mem_loc == NULL)) ||
|
||||||
|
(num_mem_objects == 0 && (mem_list != NULL || args_mem_loc != NULL)) ||
|
||||||
|
(args == NULL && (cb_args > 0 || num_mem_objects > 0)) || (args != NULL && cb_args == 0)) {
|
||||||
|
return CL_INVALID_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
amd::Command::EventWaitList eventWaitList;
|
||||||
|
cl_int err = amd::clSetEventWaitList(eventWaitList, hostQueue.context(), num_events_in_wait_list,
|
||||||
|
event_wait_list);
|
||||||
|
if (err != CL_SUCCESS) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i = 0; i < num_mem_objects; ++i) {
|
||||||
|
cl_mem obj = mem_list[i];
|
||||||
|
if (!is_valid(obj)) {
|
||||||
|
return CL_INVALID_MEM_OBJECT;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
amd::HostQueue* queue = as_amd(command_queue)->asHostQueue();
|
amd::NativeFnCommand* command = new amd::NativeFnCommand(
|
||||||
if (NULL == queue) {
|
hostQueue, eventWaitList, user_func, args, cb_args, num_mem_objects, mem_list, args_mem_loc);
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
if (command == NULL) {
|
||||||
}
|
return CL_OUT_OF_HOST_MEMORY;
|
||||||
amd::HostQueue& hostQueue = *queue;
|
}
|
||||||
|
|
||||||
const amd::Device& device = hostQueue.device();
|
command->enqueue();
|
||||||
|
|
||||||
if (!(device.info().executionCapabilities_ & CL_EXEC_NATIVE_KERNEL)) {
|
*not_null(event) = as_cl(&command->event());
|
||||||
return CL_INVALID_OPERATION;
|
if (event == NULL) {
|
||||||
}
|
command->release();
|
||||||
|
}
|
||||||
if (user_func == NULL
|
return CL_SUCCESS;
|
||||||
|| (num_mem_objects > 0 && (mem_list == NULL || args_mem_loc == NULL))
|
|
||||||
|| (num_mem_objects == 0 && (mem_list != NULL || args_mem_loc != NULL))
|
|
||||||
|| (args == NULL && (cb_args > 0 || num_mem_objects > 0))
|
|
||||||
|| (args != NULL && cb_args == 0)) {
|
|
||||||
return CL_INVALID_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::Command::EventWaitList eventWaitList;
|
|
||||||
cl_int err = amd::clSetEventWaitList(eventWaitList,
|
|
||||||
hostQueue.context(), num_events_in_wait_list, event_wait_list);
|
|
||||||
if (err != CL_SUCCESS){
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t i = 0; i < num_mem_objects; ++i) {
|
|
||||||
cl_mem obj = mem_list[i];
|
|
||||||
if (!is_valid(obj)) {
|
|
||||||
return CL_INVALID_MEM_OBJECT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::NativeFnCommand* command = new amd::NativeFnCommand(
|
|
||||||
hostQueue, eventWaitList,
|
|
||||||
user_func, args, cb_args, num_mem_objects, mem_list, args_mem_loc);
|
|
||||||
if (command == NULL) {
|
|
||||||
return CL_OUT_OF_HOST_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
command->enqueue();
|
|
||||||
|
|
||||||
*not_null(event) = as_cl(&command->event());
|
|
||||||
if (event == NULL) {
|
|
||||||
command->release();
|
|
||||||
}
|
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -581,31 +557,28 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clEnqueueMarker, (
|
RUNTIME_ENTRY(cl_int, clEnqueueMarker, (cl_command_queue command_queue, cl_event* event)) {
|
||||||
cl_command_queue command_queue,
|
if (!is_valid(command_queue)) {
|
||||||
cl_event *event))
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
{
|
}
|
||||||
if (!is_valid(command_queue)) {
|
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
||||||
if (NULL == hostQueue) {
|
if (NULL == hostQueue) {
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
amd::Command* command = new amd::Marker(*hostQueue, true);
|
amd::Command* command = new amd::Marker(*hostQueue, true);
|
||||||
if (command == NULL) {
|
if (command == NULL) {
|
||||||
return CL_OUT_OF_HOST_MEMORY;
|
return CL_OUT_OF_HOST_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
command->enqueue();
|
command->enqueue();
|
||||||
|
|
||||||
*not_null(event) = as_cl(&command->event());
|
*not_null(event) = as_cl(&command->event());
|
||||||
if (event == NULL) {
|
if (event == NULL) {
|
||||||
command->release();
|
command->release();
|
||||||
}
|
}
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -653,39 +626,36 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.2r07
|
* \version 1.2r07
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clEnqueueMarkerWithWaitList, (
|
RUNTIME_ENTRY(cl_int, clEnqueueMarkerWithWaitList,
|
||||||
cl_command_queue command_queue,
|
(cl_command_queue command_queue, cl_uint num_events_in_wait_list,
|
||||||
cl_uint num_events_in_wait_list,
|
const cl_event* event_wait_list, cl_event* event)) {
|
||||||
const cl_event *event_wait_list,
|
if (!is_valid(command_queue)) {
|
||||||
cl_event *event))
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
{
|
}
|
||||||
if (!is_valid(command_queue)) {
|
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
||||||
if (NULL == hostQueue) {
|
if (NULL == hostQueue) {
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
amd::Command::EventWaitList eventWaitList;
|
amd::Command::EventWaitList eventWaitList;
|
||||||
cl_int err = amd::clSetEventWaitList(eventWaitList,
|
cl_int err = amd::clSetEventWaitList(eventWaitList, hostQueue->context(), num_events_in_wait_list,
|
||||||
hostQueue->context(), num_events_in_wait_list, event_wait_list);
|
event_wait_list);
|
||||||
if (err != CL_SUCCESS) {
|
if (err != CL_SUCCESS) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
amd::Command* command = new amd::Marker(*hostQueue, true, eventWaitList);
|
amd::Command* command = new amd::Marker(*hostQueue, true, eventWaitList);
|
||||||
if (command == NULL) {
|
if (command == NULL) {
|
||||||
return CL_OUT_OF_HOST_MEMORY;
|
return CL_OUT_OF_HOST_MEMORY;
|
||||||
}
|
}
|
||||||
command->enqueue();
|
command->enqueue();
|
||||||
|
|
||||||
*not_null(event) = as_cl(&command->event());
|
*not_null(event) = as_cl(&command->event());
|
||||||
if (event == NULL) {
|
if (event == NULL) {
|
||||||
command->release();
|
command->release();
|
||||||
}
|
}
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -719,35 +689,31 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clEnqueueWaitForEvents, (
|
RUNTIME_ENTRY(cl_int, clEnqueueWaitForEvents,
|
||||||
cl_command_queue command_queue,
|
(cl_command_queue command_queue, cl_uint num_events, const cl_event* event_list)) {
|
||||||
cl_uint num_events,
|
if (!is_valid(command_queue)) {
|
||||||
const cl_event *event_list))
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
{
|
}
|
||||||
if (!is_valid(command_queue)) {
|
amd::HostQueue* queue = as_amd(command_queue)->asHostQueue();
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
if (NULL == queue) {
|
||||||
}
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
amd::HostQueue* queue = as_amd(command_queue)->asHostQueue();
|
}
|
||||||
if (NULL == queue) {
|
amd::HostQueue& hostQueue = *queue;
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
|
||||||
}
|
|
||||||
amd::HostQueue& hostQueue = *queue;
|
|
||||||
|
|
||||||
amd::Command::EventWaitList eventWaitList;
|
amd::Command::EventWaitList eventWaitList;
|
||||||
cl_int err = amd::clSetEventWaitList(eventWaitList,
|
cl_int err = amd::clSetEventWaitList(eventWaitList, hostQueue.context(), num_events, event_list);
|
||||||
hostQueue.context(), num_events, event_list);
|
if (err != CL_SUCCESS) {
|
||||||
if (err != CL_SUCCESS){
|
return err;
|
||||||
return err;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
amd::Command* command = new amd::Marker(hostQueue, false, eventWaitList);
|
amd::Command* command = new amd::Marker(hostQueue, false, eventWaitList);
|
||||||
if (command == NULL) {
|
if (command == NULL) {
|
||||||
return CL_OUT_OF_HOST_MEMORY;
|
return CL_OUT_OF_HOST_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
command->enqueue();
|
command->enqueue();
|
||||||
command->release();
|
command->release();
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -765,10 +731,9 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clEnqueueBarrier, (cl_command_queue command_queue))
|
RUNTIME_ENTRY(cl_int, clEnqueueBarrier, (cl_command_queue command_queue)) {
|
||||||
{
|
//! @todo: Unimplemented();
|
||||||
//! @todo: Unimplemented();
|
return CL_SUCCESS;
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -817,41 +782,38 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.2r07
|
* \version 1.2r07
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clEnqueueBarrierWithWaitList, (
|
RUNTIME_ENTRY(cl_int, clEnqueueBarrierWithWaitList,
|
||||||
cl_command_queue command_queue,
|
(cl_command_queue command_queue, cl_uint num_events_in_wait_list,
|
||||||
cl_uint num_events_in_wait_list,
|
const cl_event* event_wait_list, cl_event* event)) {
|
||||||
const cl_event *event_wait_list,
|
if (!is_valid(command_queue)) {
|
||||||
cl_event *event))
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
{
|
}
|
||||||
if (!is_valid(command_queue)) {
|
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
||||||
if (NULL == hostQueue) {
|
if (NULL == hostQueue) {
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
amd::Command::EventWaitList eventWaitList;
|
amd::Command::EventWaitList eventWaitList;
|
||||||
cl_int err = amd::clSetEventWaitList(eventWaitList,
|
cl_int err = amd::clSetEventWaitList(eventWaitList, hostQueue->context(), num_events_in_wait_list,
|
||||||
hostQueue->context(), num_events_in_wait_list, event_wait_list);
|
event_wait_list);
|
||||||
if (err != CL_SUCCESS) {
|
if (err != CL_SUCCESS) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
//!@note: with the current runtime architecture and in-order execution
|
//!@note: with the current runtime architecture and in-order execution
|
||||||
//! barrier and marker should be the same operation
|
//! barrier and marker should be the same operation
|
||||||
amd::Command* command = new amd::Marker(*hostQueue, true, eventWaitList);
|
amd::Command* command = new amd::Marker(*hostQueue, true, eventWaitList);
|
||||||
if (command == NULL) {
|
if (command == NULL) {
|
||||||
return CL_OUT_OF_HOST_MEMORY;
|
return CL_OUT_OF_HOST_MEMORY;
|
||||||
}
|
}
|
||||||
command->enqueue();
|
command->enqueue();
|
||||||
|
|
||||||
*not_null(event) = as_cl(&command->event());
|
*not_null(event) = as_cl(&command->event());
|
||||||
if (event == NULL) {
|
if (event == NULL) {
|
||||||
command->release();
|
command->release();
|
||||||
}
|
}
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -914,55 +876,51 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clGetEventProfilingInfo, (
|
RUNTIME_ENTRY(cl_int, clGetEventProfilingInfo,
|
||||||
cl_event event,
|
(cl_event event, cl_profiling_info param_name, size_t param_value_size,
|
||||||
cl_profiling_info param_name,
|
void* param_value, size_t* param_value_size_ret)) {
|
||||||
size_t param_value_size,
|
if (!is_valid(event)) {
|
||||||
void *param_value,
|
return CL_INVALID_EVENT;
|
||||||
size_t *param_value_size_ret))
|
}
|
||||||
{
|
|
||||||
if (!is_valid(event)) {
|
|
||||||
return CL_INVALID_EVENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!as_amd(event)->profilingInfo().enabled_) {
|
if (!as_amd(event)->profilingInfo().enabled_) {
|
||||||
return CL_PROFILING_INFO_NOT_AVAILABLE;
|
return CL_PROFILING_INFO_NOT_AVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (param_value != NULL && param_value_size < sizeof(cl_ulong)) {
|
if (param_value != NULL && param_value_size < sizeof(cl_ulong)) {
|
||||||
|
return CL_INVALID_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*not_null(param_value_size_ret) = sizeof(cl_ulong);
|
||||||
|
if (param_value != NULL) {
|
||||||
|
cl_ulong value = 0;
|
||||||
|
switch (param_name) {
|
||||||
|
case CL_PROFILING_COMMAND_END:
|
||||||
|
value = as_amd(event)->profilingInfo().end_;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CL_PROFILING_COMMAND_START:
|
||||||
|
value = as_amd(event)->profilingInfo().start_;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CL_PROFILING_COMMAND_SUBMIT:
|
||||||
|
value = as_amd(event)->profilingInfo().submitted_;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CL_PROFILING_COMMAND_QUEUED:
|
||||||
|
value = as_amd(event)->profilingInfo().queued_;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
|
if (value == 0) {
|
||||||
*not_null(param_value_size_ret) = sizeof(cl_ulong);
|
return CL_PROFILING_INFO_NOT_AVAILABLE;
|
||||||
if (param_value != NULL) {
|
|
||||||
cl_ulong value = 0;
|
|
||||||
switch (param_name) {
|
|
||||||
case CL_PROFILING_COMMAND_END:
|
|
||||||
value = as_amd(event)->profilingInfo().end_;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CL_PROFILING_COMMAND_START:
|
|
||||||
value = as_amd(event)->profilingInfo().start_;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CL_PROFILING_COMMAND_SUBMIT:
|
|
||||||
value = as_amd(event)->profilingInfo().submitted_;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CL_PROFILING_COMMAND_QUEUED:
|
|
||||||
value = as_amd(event)->profilingInfo().queued_;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return CL_INVALID_VALUE;
|
|
||||||
}
|
|
||||||
if (value == 0) {
|
|
||||||
return CL_PROFILING_INFO_NOT_AVAILABLE;
|
|
||||||
}
|
|
||||||
*(cl_ulong*)param_value = value;
|
|
||||||
}
|
}
|
||||||
|
*(cl_ulong*)param_value = value;
|
||||||
|
}
|
||||||
|
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -992,26 +950,25 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clFlush, (cl_command_queue command_queue))
|
RUNTIME_ENTRY(cl_int, clFlush, (cl_command_queue command_queue)) {
|
||||||
{
|
if (!is_valid(command_queue)) {
|
||||||
if (!is_valid(command_queue)) {
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
||||||
if (NULL == hostQueue) {
|
if (NULL == hostQueue) {
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
amd::Command* command = new amd::Marker(*hostQueue, false);
|
amd::Command* command = new amd::Marker(*hostQueue, false);
|
||||||
if (command == NULL) {
|
if (command == NULL) {
|
||||||
return CL_OUT_OF_HOST_MEMORY;
|
return CL_OUT_OF_HOST_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
command->enqueue();
|
command->enqueue();
|
||||||
command->release();
|
command->release();
|
||||||
|
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -1029,20 +986,19 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clFinish, (cl_command_queue command_queue))
|
RUNTIME_ENTRY(cl_int, clFinish, (cl_command_queue command_queue)) {
|
||||||
{
|
if (!is_valid(command_queue)) {
|
||||||
if (!is_valid(command_queue)) {
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
||||||
if (NULL == hostQueue) {
|
if (NULL == hostQueue) {
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
hostQueue->finish();
|
hostQueue->finish();
|
||||||
|
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
|
|||||||
+1616
-1742
File diff suppressed because it is too large
Load Diff
+167
-285
@@ -8,336 +8,218 @@
|
|||||||
#include "cl_d3d9_amd.hpp"
|
#include "cl_d3d9_amd.hpp"
|
||||||
#include "cl_d3d10_amd.hpp"
|
#include "cl_d3d10_amd.hpp"
|
||||||
#include "cl_d3d11_amd.hpp"
|
#include "cl_d3d11_amd.hpp"
|
||||||
#endif //_WIN32
|
#endif //_WIN32
|
||||||
|
|
||||||
#include <icd/icd_dispatch.h>
|
#include <icd/icd_dispatch.h>
|
||||||
|
|
||||||
amd::PlatformIDS amd::PlatformID::Platform = //{ NULL };
|
amd::PlatformIDS amd::PlatformID::Platform = //{ NULL };
|
||||||
{ amd::ICDDispatchedObject::icdVendorDispatch_ };
|
{amd::ICDDispatchedObject::icdVendorDispatch_};
|
||||||
|
|
||||||
static cl_int CL_API_CALL
|
static cl_int CL_API_CALL icdGetPlatformInfo(cl_platform_id platform, cl_platform_info param_name,
|
||||||
icdGetPlatformInfo(
|
size_t param_value_size, void* param_value,
|
||||||
cl_platform_id platform,
|
size_t* param_value_size_ret) {
|
||||||
cl_platform_info param_name,
|
return clGetPlatformInfo(NULL, param_name, param_value_size, param_value, param_value_size_ret);
|
||||||
size_t param_value_size,
|
|
||||||
void * param_value,
|
|
||||||
size_t * param_value_size_ret)
|
|
||||||
{
|
|
||||||
return clGetPlatformInfo(
|
|
||||||
NULL, param_name, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static cl_int CL_API_CALL
|
static cl_int CL_API_CALL icdGetDeviceIDs(cl_platform_id platform, cl_device_type device_type,
|
||||||
icdGetDeviceIDs(
|
cl_uint num_entries, cl_device_id* devices,
|
||||||
cl_platform_id platform,
|
cl_uint* num_devices) {
|
||||||
cl_device_type device_type,
|
return clGetDeviceIDs(NULL, device_type, num_entries, devices, num_devices);
|
||||||
cl_uint num_entries,
|
|
||||||
cl_device_id *devices,
|
|
||||||
cl_uint *num_devices)
|
|
||||||
{
|
|
||||||
return clGetDeviceIDs(
|
|
||||||
NULL, device_type, num_entries, devices, num_devices);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static cl_int CL_API_CALL
|
static cl_int CL_API_CALL icdGetDeviceInfo(cl_device_id device, cl_device_info param_name,
|
||||||
icdGetDeviceInfo(
|
size_t param_value_size, void* param_value,
|
||||||
cl_device_id device,
|
size_t* param_value_size_ret) {
|
||||||
cl_device_info param_name,
|
if (param_name == CL_DEVICE_PLATFORM) {
|
||||||
size_t param_value_size,
|
// Return the ICD platform instead of the default NULL platform.
|
||||||
void * param_value,
|
cl_platform_id platform = reinterpret_cast<cl_platform_id>(&amd::PlatformID::Platform);
|
||||||
size_t * param_value_size_ret)
|
return amd::clGetInfo(platform, param_value_size, param_value, param_value_size_ret);
|
||||||
{
|
}
|
||||||
if (param_name == CL_DEVICE_PLATFORM) {
|
|
||||||
// Return the ICD platform instead of the default NULL platform.
|
|
||||||
cl_platform_id platform = reinterpret_cast<cl_platform_id>(&amd::PlatformID::Platform);
|
|
||||||
return amd::clGetInfo(
|
|
||||||
platform, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
return clGetDeviceInfo(
|
return clGetDeviceInfo(device, param_name, param_value_size, param_value, param_value_size_ret);
|
||||||
device, param_name, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
KHRicdVendorDispatch
|
KHRicdVendorDispatch amd::ICDDispatchedObject::icdVendorDispatch_[] = {
|
||||||
amd::ICDDispatchedObject::icdVendorDispatch_[] = {{
|
{NULL /* should not get called */, icdGetPlatformInfo, icdGetDeviceIDs, icdGetDeviceInfo,
|
||||||
NULL /* should not get called */,
|
clCreateContext, clCreateContextFromType, clRetainContext, clReleaseContext, clGetContextInfo,
|
||||||
icdGetPlatformInfo,
|
clCreateCommandQueue, clRetainCommandQueue, clReleaseCommandQueue, clGetCommandQueueInfo,
|
||||||
icdGetDeviceIDs,
|
clSetCommandQueueProperty, clCreateBuffer, clCreateImage2D, clCreateImage3D, clRetainMemObject,
|
||||||
icdGetDeviceInfo,
|
clReleaseMemObject, clGetSupportedImageFormats, clGetMemObjectInfo, clGetImageInfo,
|
||||||
clCreateContext,
|
clCreateSampler, clRetainSampler, clReleaseSampler, clGetSamplerInfo,
|
||||||
clCreateContextFromType,
|
clCreateProgramWithSource, clCreateProgramWithBinary, clRetainProgram, clReleaseProgram,
|
||||||
clRetainContext,
|
clBuildProgram, clUnloadCompiler, clGetProgramInfo, clGetProgramBuildInfo, clCreateKernel,
|
||||||
clReleaseContext,
|
clCreateKernelsInProgram, clRetainKernel, clReleaseKernel, clSetKernelArg, clGetKernelInfo,
|
||||||
clGetContextInfo,
|
clGetKernelWorkGroupInfo, clWaitForEvents, clGetEventInfo, clRetainEvent, clReleaseEvent,
|
||||||
clCreateCommandQueue,
|
clGetEventProfilingInfo, clFlush, clFinish, clEnqueueReadBuffer, clEnqueueWriteBuffer,
|
||||||
clRetainCommandQueue,
|
clEnqueueCopyBuffer, clEnqueueReadImage, clEnqueueWriteImage, clEnqueueCopyImage,
|
||||||
clReleaseCommandQueue,
|
clEnqueueCopyImageToBuffer, clEnqueueCopyBufferToImage, clEnqueueMapBuffer, clEnqueueMapImage,
|
||||||
clGetCommandQueueInfo,
|
clEnqueueUnmapMemObject, clEnqueueNDRangeKernel, clEnqueueTask, clEnqueueNativeKernel,
|
||||||
clSetCommandQueueProperty,
|
clEnqueueMarker, clEnqueueWaitForEvents, clEnqueueBarrier, clGetExtensionFunctionAddress,
|
||||||
clCreateBuffer,
|
clCreateFromGLBuffer, clCreateFromGLTexture2D, clCreateFromGLTexture3D,
|
||||||
clCreateImage2D,
|
clCreateFromGLRenderbuffer, clGetGLObjectInfo, clGetGLTextureInfo, clEnqueueAcquireGLObjects,
|
||||||
clCreateImage3D,
|
clEnqueueReleaseGLObjects, clGetGLContextInfoKHR,
|
||||||
clRetainMemObject,
|
WINDOWS_SWITCH(clGetDeviceIDsFromD3D10KHR, NULL),
|
||||||
clReleaseMemObject,
|
WINDOWS_SWITCH(clCreateFromD3D10BufferKHR, NULL),
|
||||||
clGetSupportedImageFormats,
|
WINDOWS_SWITCH(clCreateFromD3D10Texture2DKHR, NULL),
|
||||||
clGetMemObjectInfo,
|
WINDOWS_SWITCH(clCreateFromD3D10Texture3DKHR, NULL),
|
||||||
clGetImageInfo,
|
WINDOWS_SWITCH(clEnqueueAcquireD3D10ObjectsKHR, NULL),
|
||||||
clCreateSampler,
|
WINDOWS_SWITCH(clEnqueueReleaseD3D10ObjectsKHR, NULL), clSetEventCallback, clCreateSubBuffer,
|
||||||
clRetainSampler,
|
clSetMemObjectDestructorCallback, clCreateUserEvent, clSetUserEventStatus,
|
||||||
clReleaseSampler,
|
clEnqueueReadBufferRect, clEnqueueWriteBufferRect, clEnqueueCopyBufferRect,
|
||||||
clGetSamplerInfo,
|
clCreateSubDevicesEXT, clRetainDeviceEXT, clReleaseDeviceEXT, clCreateEventFromGLsyncKHR,
|
||||||
clCreateProgramWithSource,
|
|
||||||
clCreateProgramWithBinary,
|
|
||||||
clRetainProgram,
|
|
||||||
clReleaseProgram,
|
|
||||||
clBuildProgram,
|
|
||||||
clUnloadCompiler,
|
|
||||||
clGetProgramInfo,
|
|
||||||
clGetProgramBuildInfo,
|
|
||||||
clCreateKernel,
|
|
||||||
clCreateKernelsInProgram,
|
|
||||||
clRetainKernel,
|
|
||||||
clReleaseKernel,
|
|
||||||
clSetKernelArg,
|
|
||||||
clGetKernelInfo,
|
|
||||||
clGetKernelWorkGroupInfo,
|
|
||||||
clWaitForEvents,
|
|
||||||
clGetEventInfo,
|
|
||||||
clRetainEvent,
|
|
||||||
clReleaseEvent,
|
|
||||||
clGetEventProfilingInfo,
|
|
||||||
clFlush,
|
|
||||||
clFinish,
|
|
||||||
clEnqueueReadBuffer,
|
|
||||||
clEnqueueWriteBuffer,
|
|
||||||
clEnqueueCopyBuffer,
|
|
||||||
clEnqueueReadImage,
|
|
||||||
clEnqueueWriteImage,
|
|
||||||
clEnqueueCopyImage,
|
|
||||||
clEnqueueCopyImageToBuffer,
|
|
||||||
clEnqueueCopyBufferToImage,
|
|
||||||
clEnqueueMapBuffer,
|
|
||||||
clEnqueueMapImage,
|
|
||||||
clEnqueueUnmapMemObject,
|
|
||||||
clEnqueueNDRangeKernel,
|
|
||||||
clEnqueueTask,
|
|
||||||
clEnqueueNativeKernel,
|
|
||||||
clEnqueueMarker,
|
|
||||||
clEnqueueWaitForEvents,
|
|
||||||
clEnqueueBarrier,
|
|
||||||
clGetExtensionFunctionAddress,
|
|
||||||
clCreateFromGLBuffer,
|
|
||||||
clCreateFromGLTexture2D,
|
|
||||||
clCreateFromGLTexture3D,
|
|
||||||
clCreateFromGLRenderbuffer,
|
|
||||||
clGetGLObjectInfo,
|
|
||||||
clGetGLTextureInfo,
|
|
||||||
clEnqueueAcquireGLObjects,
|
|
||||||
clEnqueueReleaseGLObjects,
|
|
||||||
clGetGLContextInfoKHR,
|
|
||||||
WINDOWS_SWITCH(clGetDeviceIDsFromD3D10KHR,NULL),
|
|
||||||
WINDOWS_SWITCH(clCreateFromD3D10BufferKHR,NULL),
|
|
||||||
WINDOWS_SWITCH(clCreateFromD3D10Texture2DKHR,NULL),
|
|
||||||
WINDOWS_SWITCH(clCreateFromD3D10Texture3DKHR,NULL),
|
|
||||||
WINDOWS_SWITCH(clEnqueueAcquireD3D10ObjectsKHR,NULL),
|
|
||||||
WINDOWS_SWITCH(clEnqueueReleaseD3D10ObjectsKHR,NULL),
|
|
||||||
clSetEventCallback,
|
|
||||||
clCreateSubBuffer,
|
|
||||||
clSetMemObjectDestructorCallback,
|
|
||||||
clCreateUserEvent,
|
|
||||||
clSetUserEventStatus,
|
|
||||||
clEnqueueReadBufferRect,
|
|
||||||
clEnqueueWriteBufferRect,
|
|
||||||
clEnqueueCopyBufferRect,
|
|
||||||
clCreateSubDevicesEXT,
|
|
||||||
clRetainDeviceEXT,
|
|
||||||
clReleaseDeviceEXT,
|
|
||||||
clCreateEventFromGLsyncKHR,
|
|
||||||
|
|
||||||
/* OpenCL 1.2*/
|
/* OpenCL 1.2*/
|
||||||
clCreateSubDevices,
|
clCreateSubDevices, clRetainDevice, clReleaseDevice, clCreateImage,
|
||||||
clRetainDevice,
|
clCreateProgramWithBuiltInKernels, clCompileProgram, clLinkProgram, clUnloadPlatformCompiler,
|
||||||
clReleaseDevice,
|
clGetKernelArgInfo, clEnqueueFillBuffer, clEnqueueFillImage, clEnqueueMigrateMemObjects,
|
||||||
clCreateImage,
|
clEnqueueMarkerWithWaitList, clEnqueueBarrierWithWaitList,
|
||||||
clCreateProgramWithBuiltInKernels,
|
clGetExtensionFunctionAddressForPlatform, clCreateFromGLTexture,
|
||||||
clCompileProgram,
|
|
||||||
clLinkProgram,
|
|
||||||
clUnloadPlatformCompiler,
|
|
||||||
clGetKernelArgInfo,
|
|
||||||
clEnqueueFillBuffer,
|
|
||||||
clEnqueueFillImage,
|
|
||||||
clEnqueueMigrateMemObjects,
|
|
||||||
clEnqueueMarkerWithWaitList,
|
|
||||||
clEnqueueBarrierWithWaitList,
|
|
||||||
clGetExtensionFunctionAddressForPlatform,
|
|
||||||
clCreateFromGLTexture,
|
|
||||||
|
|
||||||
WINDOWS_SWITCH(clGetDeviceIDsFromD3D11KHR,NULL),
|
WINDOWS_SWITCH(clGetDeviceIDsFromD3D11KHR, NULL),
|
||||||
WINDOWS_SWITCH(clCreateFromD3D11BufferKHR,NULL),
|
WINDOWS_SWITCH(clCreateFromD3D11BufferKHR, NULL),
|
||||||
WINDOWS_SWITCH(clCreateFromD3D11Texture2DKHR,NULL),
|
WINDOWS_SWITCH(clCreateFromD3D11Texture2DKHR, NULL),
|
||||||
WINDOWS_SWITCH(clCreateFromD3D11Texture3DKHR,NULL),
|
WINDOWS_SWITCH(clCreateFromD3D11Texture3DKHR, NULL),
|
||||||
WINDOWS_SWITCH(clCreateFromDX9MediaSurfaceKHR, NULL),
|
WINDOWS_SWITCH(clCreateFromDX9MediaSurfaceKHR, NULL),
|
||||||
WINDOWS_SWITCH(clEnqueueAcquireD3D11ObjectsKHR,NULL),
|
WINDOWS_SWITCH(clEnqueueAcquireD3D11ObjectsKHR, NULL),
|
||||||
WINDOWS_SWITCH(clEnqueueReleaseD3D11ObjectsKHR,NULL),
|
WINDOWS_SWITCH(clEnqueueReleaseD3D11ObjectsKHR, NULL),
|
||||||
|
|
||||||
WINDOWS_SWITCH(clGetDeviceIDsFromDX9MediaAdapterKHR,NULL),//KHRpfn_clGetDeviceIDsFromDX9MediaAdapterKHR clGetDeviceIDsFromDX9MediaAdapterKHR;
|
WINDOWS_SWITCH(clGetDeviceIDsFromDX9MediaAdapterKHR,
|
||||||
WINDOWS_SWITCH(clEnqueueAcquireDX9MediaSurfacesKHR, NULL), //KHRpfn_clEnqueueAcquireDX9MediaSurfacesKHR clEnqueueAcquireDX9MediaSurfacesKHR;
|
NULL), // KHRpfn_clGetDeviceIDsFromDX9MediaAdapterKHR
|
||||||
WINDOWS_SWITCH(clEnqueueReleaseDX9MediaSurfacesKHR, NULL), //KHRpfn_clEnqueueReleaseDX9MediaSurfacesKHR clEnqueueReleaseDX9MediaSurfacesKHR;
|
// clGetDeviceIDsFromDX9MediaAdapterKHR;
|
||||||
|
WINDOWS_SWITCH(
|
||||||
|
clEnqueueAcquireDX9MediaSurfacesKHR,
|
||||||
|
NULL), // KHRpfn_clEnqueueAcquireDX9MediaSurfacesKHR clEnqueueAcquireDX9MediaSurfacesKHR;
|
||||||
|
WINDOWS_SWITCH(
|
||||||
|
clEnqueueReleaseDX9MediaSurfacesKHR,
|
||||||
|
NULL), // KHRpfn_clEnqueueReleaseDX9MediaSurfacesKHR clEnqueueReleaseDX9MediaSurfacesKHR;
|
||||||
|
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL, NULL, NULL,
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
|
|
||||||
clCreateCommandQueueWithProperties,
|
clCreateCommandQueueWithProperties, clCreatePipe, clGetPipeInfo, clSVMAlloc, clSVMFree,
|
||||||
clCreatePipe,
|
clEnqueueSVMFree, clEnqueueSVMMemcpy, clEnqueueSVMMemFill, clEnqueueSVMMap, clEnqueueSVMUnmap,
|
||||||
clGetPipeInfo,
|
clCreateSamplerWithProperties, clSetKernelArgSVMPointer, clSetKernelExecInfo,
|
||||||
clSVMAlloc,
|
|
||||||
clSVMFree,
|
|
||||||
clEnqueueSVMFree,
|
|
||||||
clEnqueueSVMMemcpy,
|
|
||||||
clEnqueueSVMMemFill,
|
|
||||||
clEnqueueSVMMap,
|
|
||||||
clEnqueueSVMUnmap,
|
|
||||||
clCreateSamplerWithProperties,
|
|
||||||
clSetKernelArgSVMPointer,
|
|
||||||
clSetKernelExecInfo,
|
|
||||||
|
|
||||||
clGetKernelSubGroupInfoKHR,
|
clGetKernelSubGroupInfoKHR, clTerminateContextKHR, clCreateProgramWithILKHR}};
|
||||||
clTerminateContextKHR,
|
|
||||||
clCreateProgramWithILKHR
|
|
||||||
}};
|
|
||||||
|
|
||||||
#if defined(ATI_OS_WIN)
|
#if defined(ATI_OS_WIN)
|
||||||
#include <Shlwapi.h>
|
#include <Shlwapi.h>
|
||||||
|
|
||||||
#pragma comment( lib, "shlwapi.lib")
|
#pragma comment(lib, "shlwapi.lib")
|
||||||
|
|
||||||
static bool
|
static bool ShouldLoadPlatform() {
|
||||||
ShouldLoadPlatform()
|
// Get the OpenCL ICD registry values
|
||||||
{
|
HKEY platformsKey = NULL;
|
||||||
// Get the OpenCL ICD registry values
|
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Khronos\\OpenCL\\Vendors", 0, KEY_READ,
|
||||||
HKEY platformsKey = NULL;
|
&platformsKey) != ERROR_SUCCESS)
|
||||||
if (RegOpenKeyExA(
|
return true;
|
||||||
HKEY_LOCAL_MACHINE, "SOFTWARE\\Khronos\\OpenCL\\Vendors",
|
|
||||||
0, KEY_READ, &platformsKey)
|
|
||||||
!= ERROR_SUCCESS) return true;
|
|
||||||
|
|
||||||
std::vector<std::string> registryValues;
|
std::vector<std::string> registryValues;
|
||||||
DWORD dwIndex = 0;
|
DWORD dwIndex = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
char cszLibraryName[1024] = {0};
|
char cszLibraryName[1024] = {0};
|
||||||
DWORD dwLibraryNameSize = sizeof(cszLibraryName);
|
DWORD dwLibraryNameSize = sizeof(cszLibraryName);
|
||||||
DWORD dwLibraryNameType = 0;
|
DWORD dwLibraryNameType = 0;
|
||||||
DWORD dwValue = 0;
|
DWORD dwValue = 0;
|
||||||
DWORD dwValueSize = sizeof(dwValue);
|
DWORD dwValueSize = sizeof(dwValue);
|
||||||
|
|
||||||
if (RegEnumValueA(
|
if (RegEnumValueA(platformsKey, dwIndex++, cszLibraryName, &dwLibraryNameSize, NULL,
|
||||||
platformsKey, dwIndex++, cszLibraryName, &dwLibraryNameSize,
|
&dwLibraryNameType, (LPBYTE)&dwValue, &dwValueSize) != ERROR_SUCCESS)
|
||||||
NULL, &dwLibraryNameType, (LPBYTE) &dwValue, &dwValueSize)
|
break;
|
||||||
!= ERROR_SUCCESS) break;
|
// Require that the value be a DWORD and equal zero
|
||||||
// Require that the value be a DWORD and equal zero
|
if (dwLibraryNameType != REG_DWORD || dwValue != 0) {
|
||||||
if (dwLibraryNameType != REG_DWORD || dwValue != 0) {
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
registryValues.push_back(cszLibraryName);
|
|
||||||
}
|
}
|
||||||
RegCloseKey(platformsKey);
|
registryValues.push_back(cszLibraryName);
|
||||||
|
}
|
||||||
|
RegCloseKey(platformsKey);
|
||||||
|
|
||||||
HMODULE hm = NULL;
|
HMODULE hm = NULL;
|
||||||
if (!GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
|
if (!GetModuleHandleExA(
|
||||||
| GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
|
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
|
||||||
(LPCSTR) &ShouldLoadPlatform, &hm)) return true;
|
(LPCSTR)&ShouldLoadPlatform, &hm))
|
||||||
|
return true;
|
||||||
|
|
||||||
char cszDllPath[1024] = {0};
|
char cszDllPath[1024] = {0};
|
||||||
if (!GetModuleFileNameA(hm, cszDllPath, sizeof(cszDllPath)))
|
if (!GetModuleFileNameA(hm, cszDllPath, sizeof(cszDllPath))) return true;
|
||||||
return true;
|
|
||||||
|
|
||||||
// If we are loaded from the DriverStore, then there should be a registry
|
// If we are loaded from the DriverStore, then there should be a registry
|
||||||
// value matching our current module absolute path.
|
// value matching our current module absolute path.
|
||||||
if (std::find(registryValues.begin(), registryValues.end(), cszDllPath)
|
if (std::find(registryValues.begin(), registryValues.end(), cszDllPath) == registryValues.end())
|
||||||
== registryValues.end()) return true;
|
return true;
|
||||||
|
|
||||||
LPSTR cszFileName;
|
LPSTR cszFileName;
|
||||||
char buffer[1024] = {0};
|
char buffer[1024] = {0};
|
||||||
if (!GetFullPathNameA(cszDllPath, sizeof(buffer), buffer, &cszFileName))
|
if (!GetFullPathNameA(cszDllPath, sizeof(buffer), buffer, &cszFileName)) return true;
|
||||||
return true;
|
|
||||||
|
|
||||||
// We found an absolute path in the registry that matched this DLL, now
|
// We found an absolute path in the registry that matched this DLL, now
|
||||||
// check if there is also an entry with the same filename.
|
// check if there is also an entry with the same filename.
|
||||||
if (std::find(registryValues.begin(), registryValues.end(), cszFileName)
|
if (std::find(registryValues.begin(), registryValues.end(), cszFileName) == registryValues.end())
|
||||||
== registryValues.end()) return true;
|
return true;
|
||||||
|
|
||||||
// Lastly, check if there is a DLL with the same name in the System folder.
|
// Lastly, check if there is a DLL with the same name in the System folder.
|
||||||
char cszSystemPath[1024] = {0};
|
char cszSystemPath[1024] = {0};
|
||||||
#if defined(ATI_BITS_32)
|
#if defined(ATI_BITS_32)
|
||||||
if (!GetSystemWow64DirectoryA(cszSystemPath, sizeof(cszSystemPath)))
|
if (!GetSystemWow64DirectoryA(cszSystemPath, sizeof(cszSystemPath)))
|
||||||
#endif // defined(ATI_BITS_32)
|
#endif // defined(ATI_BITS_32)
|
||||||
if (!GetSystemDirectoryA(cszSystemPath, sizeof(cszSystemPath)))
|
if (!GetSystemDirectoryA(cszSystemPath, sizeof(cszSystemPath))) return true;
|
||||||
return true;
|
|
||||||
|
|
||||||
std::string systemDllPath;
|
std::string systemDllPath;
|
||||||
systemDllPath.append(cszSystemPath).append("\\").append(cszFileName);
|
systemDllPath.append(cszSystemPath).append("\\").append(cszFileName);
|
||||||
if (!PathFileExistsA(systemDllPath.c_str())) {
|
if (!PathFileExistsA(systemDllPath.c_str())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we get here, then all 3 conditions are true:
|
// If we get here, then all 3 conditions are true:
|
||||||
// - An entry in the registry with an absolute path matches the current DLL
|
// - An entry in the registry with an absolute path matches the current DLL
|
||||||
// - An entry in the registry with a relative path matches the current DLL
|
// - An entry in the registry with a relative path matches the current DLL
|
||||||
// - A DLL with the same name was found in the system directory
|
// - A DLL with the same name was found in the system directory
|
||||||
//
|
//
|
||||||
// We should not load this platform!
|
// We should not load this platform!
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL CALLBACK
|
static BOOL CALLBACK ShouldLoadPlatformInit(PINIT_ONCE InitOnce, PVOID Parameter, PVOID* lpContex) {
|
||||||
ShouldLoadPlatformInit(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *lpContex)
|
*reinterpret_cast<bool*>(Parameter) = ShouldLoadPlatform();
|
||||||
{
|
return TRUE;
|
||||||
*reinterpret_cast<bool*>(Parameter) = ShouldLoadPlatform();
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // defined(ATI_OS_WIN)
|
#endif // defined(ATI_OS_WIN)
|
||||||
|
|
||||||
CL_API_ENTRY cl_int CL_API_CALL
|
CL_API_ENTRY cl_int CL_API_CALL clIcdGetPlatformIDsKHR(cl_uint num_entries,
|
||||||
clIcdGetPlatformIDsKHR(
|
cl_platform_id* platforms,
|
||||||
cl_uint num_entries,
|
cl_uint* num_platforms) {
|
||||||
cl_platform_id * platforms,
|
if (((num_entries > 0 || num_platforms == NULL) && platforms == NULL) ||
|
||||||
cl_uint * num_platforms)
|
(num_entries == 0 && platforms != NULL)) {
|
||||||
{
|
return CL_INVALID_VALUE;
|
||||||
if (((num_entries > 0 || num_platforms == NULL) && platforms == NULL)
|
}
|
||||||
|| (num_entries == 0 && platforms != NULL)) {
|
|
||||||
return CL_INVALID_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(ATI_OS_WIN)
|
#if defined(ATI_OS_WIN)
|
||||||
static bool shouldLoad = true;
|
static bool shouldLoad = true;
|
||||||
|
|
||||||
static INIT_ONCE initOnce;
|
static INIT_ONCE initOnce;
|
||||||
InitOnceExecuteOnce(&initOnce, ShouldLoadPlatformInit, &shouldLoad, NULL);
|
InitOnceExecuteOnce(&initOnce, ShouldLoadPlatformInit, &shouldLoad, NULL);
|
||||||
|
|
||||||
if (!shouldLoad) {
|
if (!shouldLoad) {
|
||||||
*not_null(num_platforms) = 0;
|
*not_null(num_platforms) = 0;
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
|
||||||
#endif // defined(ATI_OS_WIN)
|
|
||||||
|
|
||||||
if (!amd::Runtime::initialized()) {
|
|
||||||
amd::Runtime::init();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (num_platforms != NULL && platforms == NULL) {
|
|
||||||
*num_platforms = 1;
|
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(platforms != NULL && "check the code above");
|
|
||||||
*platforms = reinterpret_cast<cl_platform_id>(&amd::PlatformID::Platform);
|
|
||||||
|
|
||||||
*not_null(num_platforms) = 1;
|
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
|
}
|
||||||
|
#endif // defined(ATI_OS_WIN)
|
||||||
|
|
||||||
|
if (!amd::Runtime::initialized()) {
|
||||||
|
amd::Runtime::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (num_platforms != NULL && platforms == NULL) {
|
||||||
|
*num_platforms = 1;
|
||||||
|
return CL_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(platforms != NULL && "check the code above");
|
||||||
|
*platforms = reinterpret_cast<cl_platform_id>(&amd::PlatformID::Platform);
|
||||||
|
|
||||||
|
*not_null(num_platforms) = 1;
|
||||||
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -10,114 +10,140 @@ struct clk_builtins_t;
|
|||||||
// This must be a multiple of sizeof(cl_ulong16)
|
// This must be a multiple of sizeof(cl_ulong16)
|
||||||
#define __CPU_SCRATCH_SIZE 128
|
#define __CPU_SCRATCH_SIZE 128
|
||||||
|
|
||||||
#define CLK_PRIVATE_MEMORY_SIZE (16*1024)
|
#define CLK_PRIVATE_MEMORY_SIZE (16 * 1024)
|
||||||
|
|
||||||
struct clk_thread_info_block_t
|
struct clk_thread_info_block_t {
|
||||||
{
|
// Warning! The size of this struct needs to be a multiple
|
||||||
// Warning! The size of this struct needs to be a multiple
|
// of 16 when compiling 64 bit
|
||||||
// of 16 when compiling 64 bit
|
|
||||||
|
|
||||||
struct clk_builtins_t const * builtins;
|
struct clk_builtins_t const* builtins;
|
||||||
void * local_mem_base;
|
void* local_mem_base;
|
||||||
void * local_scratch;
|
void* local_scratch;
|
||||||
const void * table_base;
|
const void* table_base;
|
||||||
size_t pad;
|
size_t pad;
|
||||||
|
|
||||||
uint work_dim;
|
uint work_dim;
|
||||||
size_t global_offset[4]; /*dim0,dim1,dim2,invalid(dim<0||dim>2)*/
|
size_t global_offset[4]; /*dim0,dim1,dim2,invalid(dim<0||dim>2)*/
|
||||||
size_t global_size[4]; /*dim0,dim1,dim2,invalid(dim<0||dim>2)*/
|
size_t global_size[4]; /*dim0,dim1,dim2,invalid(dim<0||dim>2)*/
|
||||||
|
|
||||||
size_t enqueued_local_size[4];
|
size_t enqueued_local_size[4];
|
||||||
size_t local_size[4]; /*dim0,dim1,dim2,invalid(dim<0||dim>2)*/
|
size_t local_size[4]; /*dim0,dim1,dim2,invalid(dim<0||dim>2)*/
|
||||||
size_t local_id[4]; /*dim0,dim1,dim2,invalid(dim<0||dim>2)*/
|
size_t local_id[4]; /*dim0,dim1,dim2,invalid(dim<0||dim>2)*/
|
||||||
size_t group_id[4]; /*dim0,dim1,dim2,invalid(dim<0||dim>2)*/
|
size_t group_id[4]; /*dim0,dim1,dim2,invalid(dim<0||dim>2)*/
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum clk_value_type_t
|
typedef enum clk_value_type_t {
|
||||||
{
|
T_VOID,
|
||||||
T_VOID, T_CHAR, T_SHORT, T_INT,
|
T_CHAR,
|
||||||
T_LONG, T_FLOAT, T_DOUBLE, T_POINTER,
|
T_SHORT,
|
||||||
T_CHAR2, T_CHAR3, T_CHAR4, T_CHAR8, T_CHAR16,
|
T_INT,
|
||||||
T_SHORT2, T_SHORT3, T_SHORT4, T_SHORT8, T_SHORT16,
|
T_LONG,
|
||||||
T_INT2, T_INT3, T_INT4, T_INT8, T_INT16,
|
T_FLOAT,
|
||||||
T_LONG2, T_LONG3, T_LONG4, T_LONG8, T_LONG16,
|
T_DOUBLE,
|
||||||
T_FLOAT2, T_FLOAT3, T_FLOAT4, T_FLOAT8, T_FLOAT16,
|
T_POINTER,
|
||||||
T_DOUBLE2, T_DOUBLE3, T_DOUBLE4, T_DOUBLE8, T_DOUBLE16,
|
T_CHAR2,
|
||||||
T_SAMPLER, T_SEMA, T_STRUCT, T_QUEUE, T_PAD
|
T_CHAR3,
|
||||||
|
T_CHAR4,
|
||||||
|
T_CHAR8,
|
||||||
|
T_CHAR16,
|
||||||
|
T_SHORT2,
|
||||||
|
T_SHORT3,
|
||||||
|
T_SHORT4,
|
||||||
|
T_SHORT8,
|
||||||
|
T_SHORT16,
|
||||||
|
T_INT2,
|
||||||
|
T_INT3,
|
||||||
|
T_INT4,
|
||||||
|
T_INT8,
|
||||||
|
T_INT16,
|
||||||
|
T_LONG2,
|
||||||
|
T_LONG3,
|
||||||
|
T_LONG4,
|
||||||
|
T_LONG8,
|
||||||
|
T_LONG16,
|
||||||
|
T_FLOAT2,
|
||||||
|
T_FLOAT3,
|
||||||
|
T_FLOAT4,
|
||||||
|
T_FLOAT8,
|
||||||
|
T_FLOAT16,
|
||||||
|
T_DOUBLE2,
|
||||||
|
T_DOUBLE3,
|
||||||
|
T_DOUBLE4,
|
||||||
|
T_DOUBLE8,
|
||||||
|
T_DOUBLE16,
|
||||||
|
T_SAMPLER,
|
||||||
|
T_SEMA,
|
||||||
|
T_STRUCT,
|
||||||
|
T_QUEUE,
|
||||||
|
T_PAD
|
||||||
} clk_value_type_t;
|
} clk_value_type_t;
|
||||||
|
|
||||||
typedef enum clk_address_space_t
|
typedef enum clk_address_space_t {
|
||||||
{
|
A_PRIVATE,
|
||||||
A_PRIVATE, A_LOCAL, A_CONSTANT, A_GLOBAL, A_REGION
|
A_LOCAL,
|
||||||
|
A_CONSTANT,
|
||||||
|
A_GLOBAL,
|
||||||
|
A_REGION
|
||||||
} clk_address_space_t;
|
} clk_address_space_t;
|
||||||
|
|
||||||
//kernel arg access qualifier and type qualifier
|
// kernel arg access qualifier and type qualifier
|
||||||
typedef enum clk_arg_qualifier_t
|
typedef enum clk_arg_qualifier_t {
|
||||||
{
|
Q_NONE = 0,
|
||||||
Q_NONE = 0,
|
|
||||||
|
|
||||||
//for image type only, access qualifier
|
// for image type only, access qualifier
|
||||||
Q_READ = 1,
|
Q_READ = 1,
|
||||||
Q_WRITE = 2,
|
Q_WRITE = 2,
|
||||||
|
|
||||||
//for pointer type only
|
// for pointer type only
|
||||||
Q_CONST = 4, // pointee
|
Q_CONST = 4, // pointee
|
||||||
Q_RESTRICT = 8,
|
Q_RESTRICT = 8,
|
||||||
Q_VOLATILE = 16, // pointee
|
Q_VOLATILE = 16, // pointee
|
||||||
Q_PIPE = 32 // pipe
|
Q_PIPE = 32 // pipe
|
||||||
|
|
||||||
} clk_arg_qualifier_t;
|
} clk_arg_qualifier_t;
|
||||||
|
|
||||||
#pragma pack(push, 4)
|
#pragma pack(push, 4)
|
||||||
struct clk_parameter_descriptor_t
|
struct clk_parameter_descriptor_t {
|
||||||
{
|
clk_value_type_t type;
|
||||||
clk_value_type_t type;
|
clk_address_space_t space;
|
||||||
clk_address_space_t space;
|
uint qualifier;
|
||||||
uint qualifier;
|
const char* name;
|
||||||
const char* name;
|
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
//#define CLK_LOCAL_MEM_FENCE (1 << 0)
|
//#define CLK_LOCAL_MEM_FENCE (1 << 0)
|
||||||
//#define CLK_GLOBAL_MEM_FENCE (1 << 1)
|
//#define CLK_GLOBAL_MEM_FENCE (1 << 1)
|
||||||
|
|
||||||
struct clk_builtins_t
|
struct clk_builtins_t {
|
||||||
{
|
/* Synchronization functions */
|
||||||
/* Synchronization functions */
|
void (*barrier_ptr)(cl_mem_fence_flags flags);
|
||||||
void (*barrier_ptr)(cl_mem_fence_flags flags);
|
|
||||||
|
|
||||||
/* AMD Only builtins: FIXME_lmoriche (extension) */
|
/* AMD Only builtins: FIXME_lmoriche (extension) */
|
||||||
void* reserved;
|
void* reserved;
|
||||||
int (*printf_ptr)(const char *format, ...);
|
int (*printf_ptr)(const char* format, ...);
|
||||||
};
|
};
|
||||||
|
|
||||||
enum clk_natures_t
|
enum clk_natures_t { KN_HAS_BARRIER = 1 << 0, KN_WG_LEVEL = 1 << 1 };
|
||||||
{
|
|
||||||
KN_HAS_BARRIER = 1 << 0,
|
|
||||||
KN_WG_LEVEL = 1 << 1
|
|
||||||
};
|
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma warning( push )
|
#pragma warning(push)
|
||||||
#pragma warning( disable : 4200 )
|
#pragma warning(disable : 4200)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(__OPENCL_VERSION__) || __OPENCL_VERSION__ >= 200
|
#if !defined(__OPENCL_VERSION__) || __OPENCL_VERSION__ >= 200
|
||||||
|
|
||||||
typedef struct clk_pipe_t
|
typedef struct clk_pipe_t {
|
||||||
{
|
size_t read_idx;
|
||||||
size_t read_idx;
|
size_t write_idx;
|
||||||
size_t write_idx;
|
size_t end_idx;
|
||||||
size_t end_idx;
|
char padding[128 - 3 * sizeof(size_t)];
|
||||||
char padding[128 - 3*sizeof(size_t)];
|
char packets[];
|
||||||
char packets[];
|
|
||||||
} clk_pipe_t;
|
} clk_pipe_t;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma warning( pop )
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /*CL_KERNEL_H_*/
|
#endif /*CL_KERNEL_H_*/
|
||||||
|
|
||||||
|
|||||||
@@ -42,92 +42,73 @@
|
|||||||
* \a param_value is not NULL
|
* \a param_value is not NULL
|
||||||
* - CL_INVALID_KERNEL if \a kernel is a not a valid program object
|
* - CL_INVALID_KERNEL if \a kernel is a not a valid program object
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clGetKernelInfoAMD, (
|
RUNTIME_ENTRY(cl_int, clGetKernelInfoAMD,
|
||||||
cl_kernel kernel,
|
(cl_kernel kernel, cl_device_id device, cl_kernel_info_amd param_name,
|
||||||
cl_device_id device,
|
size_t param_value_size, void* param_value, size_t* param_value_size_ret)) {
|
||||||
cl_kernel_info_amd param_name,
|
// Check if we have a valid device
|
||||||
size_t param_value_size,
|
if (!is_valid(device)) {
|
||||||
void* param_value,
|
return CL_INVALID_DEVICE;
|
||||||
size_t* param_value_size_ret))
|
}
|
||||||
{
|
|
||||||
// Check if we have a valid device
|
|
||||||
if (!is_valid(device)) {
|
|
||||||
return CL_INVALID_DEVICE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if we have a valid performance counter
|
// Check if we have a valid performance counter
|
||||||
if (!is_valid(kernel)) {
|
if (!is_valid(kernel)) {
|
||||||
return CL_INVALID_KERNEL;
|
return CL_INVALID_KERNEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the kernel, associated with the specified device
|
// Find the kernel, associated with the specified device
|
||||||
const device::Kernel* devKernel =
|
const device::Kernel* devKernel = as_amd(kernel)->getDeviceKernel(*as_amd(device));
|
||||||
as_amd(kernel)->getDeviceKernel(*as_amd(device));
|
|
||||||
|
|
||||||
// Make sure we found a valid kernel
|
// Make sure we found a valid kernel
|
||||||
if (devKernel == NULL) {
|
if (devKernel == NULL) {
|
||||||
return CL_INVALID_KERNEL;
|
return CL_INVALID_KERNEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the corresponded parameters
|
// Get the corresponded parameters
|
||||||
switch (param_name) {
|
switch (param_name) {
|
||||||
case CL_KERNELINFO_SCRATCH_REGS:
|
case CL_KERNELINFO_SCRATCH_REGS:
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(devKernel->workGroupInfo()->scratchRegs_, param_value_size, param_value,
|
||||||
devKernel->workGroupInfo()->scratchRegs_,
|
param_value_size_ret);
|
||||||
param_value_size, param_value, param_value_size_ret);
|
|
||||||
case CL_KERNELINFO_WAVEFRONT_PER_SIMD:
|
case CL_KERNELINFO_WAVEFRONT_PER_SIMD:
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(devKernel->workGroupInfo()->wavefrontPerSIMD_, param_value_size,
|
||||||
devKernel->workGroupInfo()->wavefrontPerSIMD_,
|
param_value, param_value_size_ret);
|
||||||
param_value_size, param_value, param_value_size_ret);
|
|
||||||
case CL_KERNELINFO_WAVEFRONT_SIZE:
|
case CL_KERNELINFO_WAVEFRONT_SIZE:
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(devKernel->workGroupInfo()->wavefrontSize_, param_value_size,
|
||||||
devKernel->workGroupInfo()->wavefrontSize_,
|
param_value, param_value_size_ret);
|
||||||
param_value_size, param_value, param_value_size_ret);
|
|
||||||
case CL_KERNELINFO_AVAILABLE_GPRS:
|
case CL_KERNELINFO_AVAILABLE_GPRS:
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(devKernel->workGroupInfo()->availableGPRs_, param_value_size,
|
||||||
devKernel->workGroupInfo()->availableGPRs_,
|
param_value, param_value_size_ret);
|
||||||
param_value_size, param_value, param_value_size_ret);
|
|
||||||
case CL_KERNELINFO_USED_GPRS:
|
case CL_KERNELINFO_USED_GPRS:
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(devKernel->workGroupInfo()->usedGPRs_, param_value_size, param_value,
|
||||||
devKernel->workGroupInfo()->usedGPRs_,
|
param_value_size_ret);
|
||||||
param_value_size, param_value, param_value_size_ret);
|
|
||||||
case CL_KERNELINFO_AVAILABLE_SGPRS:
|
case CL_KERNELINFO_AVAILABLE_SGPRS:
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(devKernel->workGroupInfo()->availableSGPRs_, param_value_size,
|
||||||
devKernel->workGroupInfo()->availableSGPRs_,
|
param_value, param_value_size_ret);
|
||||||
param_value_size, param_value, param_value_size_ret);
|
|
||||||
case CL_KERNELINFO_USED_SGPRS:
|
case CL_KERNELINFO_USED_SGPRS:
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(devKernel->workGroupInfo()->usedSGPRs_, param_value_size, param_value,
|
||||||
devKernel->workGroupInfo()->usedSGPRs_,
|
param_value_size_ret);
|
||||||
param_value_size, param_value, param_value_size_ret);
|
|
||||||
case CL_KERNELINFO_AVAILABLE_VGPRS:
|
case CL_KERNELINFO_AVAILABLE_VGPRS:
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(devKernel->workGroupInfo()->availableVGPRs_, param_value_size,
|
||||||
devKernel->workGroupInfo()->availableVGPRs_,
|
param_value, param_value_size_ret);
|
||||||
param_value_size, param_value, param_value_size_ret);
|
|
||||||
case CL_KERNELINFO_USED_VGPRS:
|
case CL_KERNELINFO_USED_VGPRS:
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(devKernel->workGroupInfo()->usedVGPRs_, param_value_size, param_value,
|
||||||
devKernel->workGroupInfo()->usedVGPRs_,
|
param_value_size_ret);
|
||||||
param_value_size, param_value, param_value_size_ret);
|
|
||||||
case CL_KERNELINFO_AVAILABLE_LDS_SIZE:
|
case CL_KERNELINFO_AVAILABLE_LDS_SIZE:
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(devKernel->workGroupInfo()->availableLDSSize_, param_value_size,
|
||||||
devKernel->workGroupInfo()->availableLDSSize_,
|
param_value, param_value_size_ret);
|
||||||
param_value_size, param_value, param_value_size_ret);
|
|
||||||
case CL_KERNELINFO_USED_LDS_SIZE:
|
case CL_KERNELINFO_USED_LDS_SIZE:
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(devKernel->workGroupInfo()->usedLDSSize_, param_value_size, param_value,
|
||||||
devKernel->workGroupInfo()->usedLDSSize_,
|
param_value_size_ret);
|
||||||
param_value_size, param_value, param_value_size_ret);
|
|
||||||
case CL_KERNELINFO_AVAILABLE_STACK_SIZE:
|
case CL_KERNELINFO_AVAILABLE_STACK_SIZE:
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(devKernel->workGroupInfo()->availableStackSize_, param_value_size,
|
||||||
devKernel->workGroupInfo()->availableStackSize_,
|
param_value, param_value_size_ret);
|
||||||
param_value_size, param_value, param_value_size_ret);
|
|
||||||
case CL_KERNELINFO_USED_STACK_SIZE:
|
case CL_KERNELINFO_USED_STACK_SIZE:
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(devKernel->workGroupInfo()->usedStackSize_, param_value_size,
|
||||||
devKernel->workGroupInfo()->usedStackSize_,
|
param_value, param_value_size_ret);
|
||||||
param_value_size, param_value, param_value_size_ret);
|
|
||||||
default:
|
default:
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
|
|||||||
@@ -102,23 +102,22 @@ extern "C" {
|
|||||||
typedef cl_uint cl_kernel_info_amd;
|
typedef cl_uint cl_kernel_info_amd;
|
||||||
|
|
||||||
/* cl_kernel_info */
|
/* cl_kernel_info */
|
||||||
enum KernelInfoAMD
|
enum KernelInfoAMD {
|
||||||
{
|
CL_KERNELINFO_NONE = 0x0,
|
||||||
CL_KERNELINFO_NONE = 0x0,
|
CL_KERNELINFO_SCRATCH_REGS,
|
||||||
CL_KERNELINFO_SCRATCH_REGS,
|
CL_KERNELINFO_WAVEFRONT_PER_SIMD,
|
||||||
CL_KERNELINFO_WAVEFRONT_PER_SIMD,
|
CL_KERNELINFO_WAVEFRONT_SIZE,
|
||||||
CL_KERNELINFO_WAVEFRONT_SIZE,
|
CL_KERNELINFO_AVAILABLE_GPRS,
|
||||||
CL_KERNELINFO_AVAILABLE_GPRS,
|
CL_KERNELINFO_USED_GPRS,
|
||||||
CL_KERNELINFO_USED_GPRS,
|
CL_KERNELINFO_AVAILABLE_LDS_SIZE,
|
||||||
CL_KERNELINFO_AVAILABLE_LDS_SIZE,
|
CL_KERNELINFO_USED_LDS_SIZE,
|
||||||
CL_KERNELINFO_USED_LDS_SIZE,
|
CL_KERNELINFO_AVAILABLE_STACK_SIZE,
|
||||||
CL_KERNELINFO_AVAILABLE_STACK_SIZE,
|
CL_KERNELINFO_USED_STACK_SIZE,
|
||||||
CL_KERNELINFO_USED_STACK_SIZE,
|
CL_KERNELINFO_AVAILABLE_SGPRS,
|
||||||
CL_KERNELINFO_AVAILABLE_SGPRS,
|
CL_KERNELINFO_USED_SGPRS,
|
||||||
CL_KERNELINFO_USED_SGPRS,
|
CL_KERNELINFO_AVAILABLE_VGPRS,
|
||||||
CL_KERNELINFO_AVAILABLE_VGPRS,
|
CL_KERNELINFO_USED_VGPRS,
|
||||||
CL_KERNELINFO_USED_VGPRS,
|
CL_KERNELINFO_LAST
|
||||||
CL_KERNELINFO_LAST
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! \brief Retrieves the kernel information.
|
/*! \brief Retrieves the kernel information.
|
||||||
@@ -148,18 +147,13 @@ enum KernelInfoAMD
|
|||||||
* \a param_value is not NULL
|
* \a param_value is not NULL
|
||||||
* - CL_INVALID_KERNEL if \a kernel is a not a valid program object
|
* - CL_INVALID_KERNEL if \a kernel is a not a valid program object
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
extern CL_API_ENTRY cl_int CL_API_CALL clGetKernelInfoAMD(
|
||||||
clGetKernelInfoAMD(
|
cl_kernel /* kernel */, cl_device_id /* device */, cl_kernel_info_amd /* param_name */,
|
||||||
cl_kernel /* kernel */,
|
size_t /* param_value_size */, void* /* param_value */, size_t* /* param_value_size_ret */
|
||||||
cl_device_id /* device */,
|
) CL_API_SUFFIX__VERSION_1_0;
|
||||||
cl_kernel_info_amd /* param_name */,
|
|
||||||
size_t /* param_value_size */,
|
|
||||||
void* /* param_value */,
|
|
||||||
size_t* /* param_value_size_ret */
|
|
||||||
) CL_API_SUFFIX__VERSION_1_0;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /*extern "C"*/
|
} /*extern "C"*/
|
||||||
#endif /*__cplusplus*/
|
#endif /*__cplusplus*/
|
||||||
|
|
||||||
#endif /*__CL_KERNEL_INFO_AMD_H*/
|
#endif /*__CL_KERNEL_INFO_AMD_H*/
|
||||||
|
|||||||
@@ -11,98 +11,89 @@
|
|||||||
|
|
||||||
#if defined __linux__
|
#if defined __linux__
|
||||||
typedef wchar_t char_t;
|
typedef wchar_t char_t;
|
||||||
#endif // __linux__
|
#endif // __linux__
|
||||||
|
|
||||||
#if !defined(BUILD_HSA_TARGET) && defined(_WIN32)
|
#if !defined(BUILD_HSA_TARGET) && defined(_WIN32)
|
||||||
#define WITH_LIQUID_FLASH 1
|
#define WITH_LIQUID_FLASH 1
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
#if defined(WITH_LIQUID_FLASH)
|
#if defined(WITH_LIQUID_FLASH)
|
||||||
#include "lf.h"
|
#include "lf.h"
|
||||||
#endif // WITH_LIQUID_FLASH
|
#endif // WITH_LIQUID_FLASH
|
||||||
|
|
||||||
|
|
||||||
namespace amd {
|
namespace amd {
|
||||||
|
|
||||||
LiquidFlashFile::~LiquidFlashFile()
|
LiquidFlashFile::~LiquidFlashFile() { close(); }
|
||||||
{
|
|
||||||
close();
|
bool LiquidFlashFile::open() {
|
||||||
|
#if defined WITH_LIQUID_FLASH
|
||||||
|
lf_status err;
|
||||||
|
lf_file_flags flags;
|
||||||
|
|
||||||
|
switch (flags_) {
|
||||||
|
case CL_FILE_READ_ONLY_AMD:
|
||||||
|
flags = LF_READ;
|
||||||
|
break;
|
||||||
|
case CL_FILE_WRITE_ONLY_AMD:
|
||||||
|
flags = LF_WRITE;
|
||||||
|
break;
|
||||||
|
case CL_FILE_READ_WRITE_AMD:
|
||||||
|
flags = LF_READ | LF_WRITE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
handle_ = lfOpenFile(name_, flags, &err);
|
||||||
|
if (err != lf_success) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lfGetFileBlockSize((lf_file)handle_, &blockSize_) != lf_success) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lfGetFileSize((lf_file)handle_, &fileSize_) != lf_success) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif // WITH_LIQUID_FLASH
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
void LiquidFlashFile::close() {
|
||||||
LiquidFlashFile::open()
|
|
||||||
{
|
|
||||||
#if defined WITH_LIQUID_FLASH
|
#if defined WITH_LIQUID_FLASH
|
||||||
lf_status err;
|
if (handle_ != NULL) {
|
||||||
lf_file_flags flags;
|
lfReleaseFile((lf_file)handle_);
|
||||||
|
handle_ = NULL;
|
||||||
|
}
|
||||||
|
#endif // WITH_LIQUID_FLASH
|
||||||
|
}
|
||||||
|
|
||||||
switch (flags_) {
|
bool LiquidFlashFile::transferBlock(bool writeBuffer, void* srcDst, uint64_t bufferSize,
|
||||||
case CL_FILE_READ_ONLY_AMD: flags = LF_READ; break;
|
uint64_t fileOffset, uint64_t bufferOffset,
|
||||||
case CL_FILE_WRITE_ONLY_AMD: flags = LF_WRITE; break;
|
uint64_t size) const {
|
||||||
case CL_FILE_READ_WRITE_AMD: flags = LF_READ|LF_WRITE; break;
|
#if defined WITH_LIQUID_FLASH
|
||||||
}
|
lf_status status;
|
||||||
|
|
||||||
handle_ = lfOpenFile(name_, flags, &err);
|
lf_region_descriptor region = {fileOffset / blockSize(), bufferOffset / blockSize(),
|
||||||
if (err != lf_success) {
|
size / blockSize()};
|
||||||
return false;
|
if (writeBuffer) {
|
||||||
}
|
status = lfReadFile(srcDst, bufferSize, (lf_file)handle_, 1, ®ion, NULL);
|
||||||
|
} else {
|
||||||
if (lfGetFileBlockSize((lf_file)handle_, &blockSize_) != lf_success) {
|
status = lfWriteFile(srcDst, bufferSize, (lf_file)handle_, 1, ®ion, NULL);
|
||||||
return false;
|
}
|
||||||
}
|
if (lf_success == status) {
|
||||||
|
|
||||||
if (lfGetFileSize((lf_file)handle_, &fileSize_) != lf_success) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
#else
|
} else {
|
||||||
return false;
|
return false;
|
||||||
#endif // WITH_LIQUID_FLASH
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
LiquidFlashFile::close()
|
|
||||||
{
|
|
||||||
#if defined WITH_LIQUID_FLASH
|
|
||||||
if (handle_ != NULL) {
|
|
||||||
lfReleaseFile((lf_file)handle_);
|
|
||||||
handle_ = NULL;
|
|
||||||
}
|
|
||||||
#endif // WITH_LIQUID_FLASH
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
LiquidFlashFile::transferBlock(
|
|
||||||
bool writeBuffer,
|
|
||||||
void* srcDst,
|
|
||||||
uint64_t bufferSize,
|
|
||||||
uint64_t fileOffset,
|
|
||||||
uint64_t bufferOffset,
|
|
||||||
uint64_t size) const
|
|
||||||
{
|
|
||||||
#if defined WITH_LIQUID_FLASH
|
|
||||||
lf_status status;
|
|
||||||
|
|
||||||
lf_region_descriptor region =
|
|
||||||
{ fileOffset / blockSize(), bufferOffset / blockSize(), size / blockSize() };
|
|
||||||
if (writeBuffer) {
|
|
||||||
status = lfReadFile(srcDst, bufferSize, (lf_file)handle_, 1, ®ion, NULL);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
status = lfWriteFile(srcDst, bufferSize, (lf_file)handle_, 1, ®ion, NULL);
|
|
||||||
}
|
|
||||||
if (lf_success == status) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif // WITH_LIQUID_FLASH
|
#endif // WITH_LIQUID_FLASH
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace amd
|
} // namespace amd
|
||||||
|
|
||||||
/*! \addtogroup API
|
/*! \addtogroup API
|
||||||
* @{
|
* @{
|
||||||
@@ -112,224 +103,164 @@ LiquidFlashFile::transferBlock(
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
RUNTIME_ENTRY_RET(cl_file_amd, clCreateSsgFileObjectAMD, (
|
RUNTIME_ENTRY_RET(cl_file_amd, clCreateSsgFileObjectAMD,
|
||||||
cl_context context,
|
(cl_context context, cl_file_flags_amd flags, const wchar_t* file_name,
|
||||||
cl_file_flags_amd flags,
|
cl_int* errcode_ret)) {
|
||||||
const wchar_t* file_name,
|
amd::LiquidFlashFile* file = new amd::LiquidFlashFile(file_name, flags);
|
||||||
cl_int* errcode_ret))
|
|
||||||
{
|
|
||||||
amd::LiquidFlashFile* file = new amd::LiquidFlashFile(file_name, flags);
|
|
||||||
|
|
||||||
if (file == NULL) {
|
if (file == NULL) {
|
||||||
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
|
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
|
||||||
return (cl_file_amd)0;
|
return (cl_file_amd)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file->open()) {
|
if (!file->open()) {
|
||||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||||
delete file;
|
delete file;
|
||||||
return (cl_file_amd)0;
|
return (cl_file_amd)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
*not_null(errcode_ret) = CL_SUCCESS;
|
*not_null(errcode_ret) = CL_SUCCESS;
|
||||||
return as_cl(file);
|
return as_cl(file);
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
RUNTIME_ENTRY(cl_int, clGetSsgFileObjectInfoAMD, (
|
RUNTIME_ENTRY(cl_int, clGetSsgFileObjectInfoAMD,
|
||||||
cl_file_amd file,
|
(cl_file_amd file, cl_file_info_amd param_name, size_t param_value_size,
|
||||||
cl_file_info_amd param_name,
|
void* param_value, size_t* param_value_size_ret)) {
|
||||||
size_t param_value_size,
|
if (!is_valid(file)) {
|
||||||
void * param_value,
|
return CL_INVALID_FILE_OBJECT_AMD;
|
||||||
size_t * param_value_size_ret))
|
}
|
||||||
{
|
|
||||||
if (!is_valid(file)) {
|
|
||||||
return CL_INVALID_FILE_OBJECT_AMD;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (param_name) {
|
switch (param_name) {
|
||||||
case CL_FILE_BLOCK_SIZE_AMD: {
|
case CL_FILE_BLOCK_SIZE_AMD: {
|
||||||
cl_uint blockSize = as_amd(file)->blockSize();
|
cl_uint blockSize = as_amd(file)->blockSize();
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(blockSize, param_value_size, param_value, param_value_size_ret);
|
||||||
blockSize, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
case CL_FILE_SIZE_AMD: {
|
case CL_FILE_SIZE_AMD: {
|
||||||
cl_ulong fileSize = as_amd(file)->fileSize();
|
cl_ulong fileSize = as_amd(file)->fileSize();
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(fileSize, param_value_size, param_value, param_value_size_ret);
|
||||||
fileSize, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return CL_INVALID_VALUE;
|
||||||
|
}
|
||||||
|
RUNTIME_EXIT
|
||||||
|
|
||||||
|
RUNTIME_ENTRY(cl_int, clRetainSsgFileObjectAMD, (cl_file_amd file)) {
|
||||||
|
if (!is_valid(file)) {
|
||||||
|
return CL_INVALID_FILE_OBJECT_AMD;
|
||||||
|
}
|
||||||
|
as_amd(file)->retain();
|
||||||
|
return CL_SUCCESS;
|
||||||
|
}
|
||||||
|
RUNTIME_EXIT
|
||||||
|
|
||||||
|
RUNTIME_ENTRY(cl_int, clReleaseSsgFileObjectAMD, (cl_file_amd file)) {
|
||||||
|
if (!is_valid(file)) {
|
||||||
|
return CL_INVALID_FILE_OBJECT_AMD;
|
||||||
|
}
|
||||||
|
as_amd(file)->release();
|
||||||
|
return CL_SUCCESS;
|
||||||
|
}
|
||||||
|
RUNTIME_EXIT
|
||||||
|
|
||||||
|
static cl_int EnqueueTransferBufferFromSsgFileAMD(
|
||||||
|
cl_bool isWrite, cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write,
|
||||||
|
size_t buffer_offset, size_t cb, cl_file_amd file, size_t file_offset,
|
||||||
|
cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) {
|
||||||
|
if (!is_valid(command_queue)) {
|
||||||
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_valid(buffer)) {
|
||||||
|
return CL_INVALID_MEM_OBJECT;
|
||||||
|
}
|
||||||
|
amd::Buffer* pBuffer = as_amd(buffer)->asBuffer();
|
||||||
|
if (pBuffer == NULL) {
|
||||||
|
return CL_INVALID_MEM_OBJECT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pBuffer->getMemFlags() & (CL_MEM_HOST_READ_ONLY | CL_MEM_HOST_NO_ACCESS)) {
|
||||||
|
return CL_INVALID_OPERATION;
|
||||||
|
}
|
||||||
|
|
||||||
|
amd::HostQueue* queue = as_amd(command_queue)->asHostQueue();
|
||||||
|
if (NULL == queue) {
|
||||||
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
|
}
|
||||||
|
amd::HostQueue& hostQueue = *queue;
|
||||||
|
|
||||||
|
if (hostQueue.context() != pBuffer->getContext()) {
|
||||||
|
return CL_INVALID_CONTEXT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_valid(file)) {
|
||||||
|
return CL_INVALID_FILE_OBJECT_AMD;
|
||||||
|
}
|
||||||
|
|
||||||
|
amd::LiquidFlashFile* amdFile = as_amd(file);
|
||||||
|
amd::Coord3D bufferOffset(buffer_offset, 0, 0);
|
||||||
|
amd::Coord3D bufferSize(cb, 1, 1);
|
||||||
|
|
||||||
|
if ((!pBuffer->validateRegion(bufferOffset, bufferSize)) ||
|
||||||
|
// LF library supports aligned sizes only
|
||||||
|
((buffer_offset % amdFile->blockSize()) != 0) || ((cb % amdFile->blockSize()) != 0) ||
|
||||||
|
((file_offset % amdFile->blockSize()) != 0)) {
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
amd::Command::EventWaitList eventWaitList;
|
||||||
|
cl_int err = amd::clSetEventWaitList(eventWaitList, hostQueue.context(), num_events_in_wait_list,
|
||||||
|
event_wait_list);
|
||||||
|
if (err != CL_SUCCESS) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
amd::TransferBufferFileCommand* command;
|
||||||
|
command = new amd::TransferBufferFileCommand(
|
||||||
|
isWrite ? CL_COMMAND_READ_SSG_FILE_AMD : CL_COMMAND_WRITE_SSG_FILE_AMD, hostQueue,
|
||||||
|
eventWaitList, *pBuffer, bufferOffset, bufferSize, amdFile, file_offset);
|
||||||
|
|
||||||
|
if (command == NULL) {
|
||||||
|
return CL_OUT_OF_HOST_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure we have memory for the command execution
|
||||||
|
if (!command->validateMemory()) {
|
||||||
|
delete command;
|
||||||
|
return CL_MEM_OBJECT_ALLOCATION_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
command->enqueue();
|
||||||
|
if (blocking_write) {
|
||||||
|
command->awaitCompletion();
|
||||||
|
}
|
||||||
|
|
||||||
|
*not_null(event) = as_cl(&command->event());
|
||||||
|
if (event == NULL) {
|
||||||
|
command->release();
|
||||||
|
}
|
||||||
|
return CL_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
RUNTIME_ENTRY(cl_int, clEnqueueReadSsgFileAMD,
|
||||||
|
(cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write,
|
||||||
|
size_t buffer_offset, size_t cb, cl_file_amd file, size_t file_offset,
|
||||||
|
cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event)) {
|
||||||
|
return EnqueueTransferBufferFromSsgFileAMD(CL_TRUE, command_queue, buffer, blocking_write,
|
||||||
|
buffer_offset, cb, file, file_offset,
|
||||||
|
num_events_in_wait_list, event_wait_list, event);
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
RUNTIME_ENTRY(cl_int, clRetainSsgFileObjectAMD, (
|
RUNTIME_ENTRY(cl_int, clEnqueueWriteSsgFileAMD,
|
||||||
cl_file_amd file))
|
(cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write,
|
||||||
{
|
size_t buffer_offset, size_t cb, cl_file_amd file, size_t file_offset,
|
||||||
if (!is_valid(file)) {
|
cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event)) {
|
||||||
return CL_INVALID_FILE_OBJECT_AMD;
|
return EnqueueTransferBufferFromSsgFileAMD(CL_FALSE, command_queue, buffer, blocking_write,
|
||||||
}
|
buffer_offset, cb, file, file_offset,
|
||||||
as_amd(file)->retain();
|
num_events_in_wait_list, event_wait_list, event);
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
|
||||||
RUNTIME_EXIT
|
|
||||||
|
|
||||||
RUNTIME_ENTRY(cl_int, clReleaseSsgFileObjectAMD, (
|
|
||||||
cl_file_amd file))
|
|
||||||
{
|
|
||||||
if (!is_valid(file)) {
|
|
||||||
return CL_INVALID_FILE_OBJECT_AMD;
|
|
||||||
}
|
|
||||||
as_amd(file)->release();
|
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
|
||||||
RUNTIME_EXIT
|
|
||||||
|
|
||||||
static cl_int
|
|
||||||
EnqueueTransferBufferFromSsgFileAMD(
|
|
||||||
cl_bool isWrite,
|
|
||||||
cl_command_queue command_queue,
|
|
||||||
cl_mem buffer,
|
|
||||||
cl_bool blocking_write,
|
|
||||||
size_t buffer_offset,
|
|
||||||
size_t cb,
|
|
||||||
cl_file_amd file,
|
|
||||||
size_t file_offset,
|
|
||||||
cl_uint num_events_in_wait_list,
|
|
||||||
const cl_event *event_wait_list,
|
|
||||||
cl_event *event)
|
|
||||||
{
|
|
||||||
if (!is_valid(command_queue)) {
|
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_valid(buffer)) {
|
|
||||||
return CL_INVALID_MEM_OBJECT;
|
|
||||||
}
|
|
||||||
amd::Buffer* pBuffer = as_amd(buffer)->asBuffer();
|
|
||||||
if (pBuffer == NULL) {
|
|
||||||
return CL_INVALID_MEM_OBJECT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pBuffer->getMemFlags() &
|
|
||||||
(CL_MEM_HOST_READ_ONLY | CL_MEM_HOST_NO_ACCESS)) {
|
|
||||||
return CL_INVALID_OPERATION;
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::HostQueue* queue = as_amd(command_queue)->asHostQueue();
|
|
||||||
if (NULL == queue) {
|
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
|
||||||
}
|
|
||||||
amd::HostQueue& hostQueue = *queue;
|
|
||||||
|
|
||||||
if(hostQueue.context() != pBuffer->getContext()) {
|
|
||||||
return CL_INVALID_CONTEXT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_valid(file)) {
|
|
||||||
return CL_INVALID_FILE_OBJECT_AMD;
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::LiquidFlashFile* amdFile = as_amd(file);
|
|
||||||
amd::Coord3D bufferOffset(buffer_offset, 0, 0);
|
|
||||||
amd::Coord3D bufferSize(cb, 1, 1);
|
|
||||||
|
|
||||||
if ((!pBuffer->validateRegion(bufferOffset, bufferSize)) ||
|
|
||||||
// LF library supports aligned sizes only
|
|
||||||
((buffer_offset % amdFile->blockSize()) != 0) ||
|
|
||||||
((cb % amdFile->blockSize()) != 0) ||
|
|
||||||
((file_offset % amdFile->blockSize()) != 0)) {
|
|
||||||
return CL_INVALID_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::Command::EventWaitList eventWaitList;
|
|
||||||
cl_int err = amd::clSetEventWaitList(eventWaitList,
|
|
||||||
hostQueue.context(), num_events_in_wait_list, event_wait_list);
|
|
||||||
if (err != CL_SUCCESS){
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::TransferBufferFileCommand *command;
|
|
||||||
command = new amd::TransferBufferFileCommand(
|
|
||||||
isWrite ? CL_COMMAND_READ_SSG_FILE_AMD : CL_COMMAND_WRITE_SSG_FILE_AMD,
|
|
||||||
hostQueue, eventWaitList, *pBuffer, bufferOffset, bufferSize,
|
|
||||||
amdFile, file_offset);
|
|
||||||
|
|
||||||
if (command == NULL) {
|
|
||||||
return CL_OUT_OF_HOST_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure we have memory for the command execution
|
|
||||||
if (!command->validateMemory()) {
|
|
||||||
delete command;
|
|
||||||
return CL_MEM_OBJECT_ALLOCATION_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
command->enqueue();
|
|
||||||
if (blocking_write) {
|
|
||||||
command->awaitCompletion();
|
|
||||||
}
|
|
||||||
|
|
||||||
*not_null(event) = as_cl(&command->event());
|
|
||||||
if (event == NULL) {
|
|
||||||
command->release();
|
|
||||||
}
|
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
RUNTIME_ENTRY(cl_int, clEnqueueReadSsgFileAMD, (
|
|
||||||
cl_command_queue command_queue,
|
|
||||||
cl_mem buffer,
|
|
||||||
cl_bool blocking_write,
|
|
||||||
size_t buffer_offset,
|
|
||||||
size_t cb,
|
|
||||||
cl_file_amd file,
|
|
||||||
size_t file_offset,
|
|
||||||
cl_uint num_events_in_wait_list,
|
|
||||||
const cl_event *event_wait_list,
|
|
||||||
cl_event *event))
|
|
||||||
{
|
|
||||||
return EnqueueTransferBufferFromSsgFileAMD(
|
|
||||||
CL_TRUE,
|
|
||||||
command_queue,
|
|
||||||
buffer,
|
|
||||||
blocking_write,
|
|
||||||
buffer_offset,
|
|
||||||
cb,
|
|
||||||
file,
|
|
||||||
file_offset,
|
|
||||||
num_events_in_wait_list,
|
|
||||||
event_wait_list,
|
|
||||||
event);
|
|
||||||
}
|
|
||||||
RUNTIME_EXIT
|
|
||||||
|
|
||||||
RUNTIME_ENTRY(cl_int, clEnqueueWriteSsgFileAMD, (
|
|
||||||
cl_command_queue command_queue,
|
|
||||||
cl_mem buffer,
|
|
||||||
cl_bool blocking_write,
|
|
||||||
size_t buffer_offset,
|
|
||||||
size_t cb,
|
|
||||||
cl_file_amd file,
|
|
||||||
size_t file_offset,
|
|
||||||
cl_uint num_events_in_wait_list,
|
|
||||||
const cl_event * event_wait_list,
|
|
||||||
cl_event * event))
|
|
||||||
{
|
|
||||||
return EnqueueTransferBufferFromSsgFileAMD(
|
|
||||||
CL_FALSE,
|
|
||||||
command_queue,
|
|
||||||
buffer,
|
|
||||||
blocking_write,
|
|
||||||
buffer_offset,
|
|
||||||
cb,
|
|
||||||
file,
|
|
||||||
file_offset,
|
|
||||||
num_events_in_wait_list,
|
|
||||||
event_wait_list,
|
|
||||||
event);
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|||||||
@@ -8,53 +8,28 @@ extern "C" {
|
|||||||
#endif /*__cplusplus*/
|
#endif /*__cplusplus*/
|
||||||
|
|
||||||
extern CL_API_ENTRY cl_file_amd CL_API_CALL
|
extern CL_API_ENTRY cl_file_amd CL_API_CALL
|
||||||
clCreateSsgFileObjectAMD(
|
clCreateSsgFileObjectAMD(cl_context context, cl_file_flags_amd flags, const wchar_t* file_name,
|
||||||
cl_context context,
|
cl_int* errcode_ret) CL_EXT_SUFFIX__VERSION_1_2;
|
||||||
cl_file_flags_amd flags,
|
|
||||||
const wchar_t * file_name,
|
|
||||||
cl_int * errcode_ret) CL_EXT_SUFFIX__VERSION_1_2;
|
|
||||||
|
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
extern CL_API_ENTRY cl_int CL_API_CALL clGetSsgFileObjectInfoAMD(
|
||||||
clGetSsgFileObjectInfoAMD(
|
cl_file_amd file, cl_file_info_amd param_name, size_t param_value_size, void* param_value,
|
||||||
cl_file_amd file,
|
size_t* param_value_size_ret) CL_EXT_SUFFIX__VERSION_1_2;
|
||||||
cl_file_info_amd param_name,
|
|
||||||
size_t param_value_size,
|
|
||||||
void * param_value,
|
|
||||||
size_t * param_value_size_ret) CL_EXT_SUFFIX__VERSION_1_2;
|
|
||||||
|
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
extern CL_API_ENTRY cl_int CL_API_CALL clRetainSsgFileObjectAMD(cl_file_amd file)
|
||||||
clRetainSsgFileObjectAMD(
|
CL_EXT_SUFFIX__VERSION_1_2;
|
||||||
cl_file_amd file) CL_EXT_SUFFIX__VERSION_1_2;
|
|
||||||
|
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
extern CL_API_ENTRY cl_int CL_API_CALL clReleaseSsgFileObjectAMD(cl_file_amd file)
|
||||||
clReleaseSsgFileObjectAMD(
|
CL_EXT_SUFFIX__VERSION_1_2;
|
||||||
cl_file_amd file) CL_EXT_SUFFIX__VERSION_1_2;
|
|
||||||
|
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueReadSsgFileAMD(
|
||||||
clEnqueueReadSsgFileAMD(
|
cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write, size_t buffer_offset,
|
||||||
cl_command_queue command_queue,
|
size_t cb, cl_file_amd file, size_t file_offset, cl_uint num_events_in_wait_list,
|
||||||
cl_mem buffer,
|
const cl_event* event_wait_list, cl_event* event) CL_EXT_SUFFIX__VERSION_1_2;
|
||||||
cl_bool blocking_write,
|
|
||||||
size_t buffer_offset,
|
|
||||||
size_t cb,
|
|
||||||
cl_file_amd file,
|
|
||||||
size_t file_offset,
|
|
||||||
cl_uint num_events_in_wait_list,
|
|
||||||
const cl_event * event_wait_list,
|
|
||||||
cl_event * event) CL_EXT_SUFFIX__VERSION_1_2;
|
|
||||||
|
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueWriteSsgFileAMD(
|
||||||
clEnqueueWriteSsgFileAMD(
|
cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write, size_t buffer_offset,
|
||||||
cl_command_queue command_queue,
|
size_t cb, cl_file_amd file, size_t file_offset, cl_uint num_events_in_wait_list,
|
||||||
cl_mem buffer,
|
const cl_event* event_wait_list, cl_event* event) CL_EXT_SUFFIX__VERSION_1_2;
|
||||||
cl_bool blocking_write,
|
|
||||||
size_t buffer_offset,
|
|
||||||
size_t cb,
|
|
||||||
cl_file_amd file,
|
|
||||||
size_t file_offset,
|
|
||||||
cl_uint num_events_in_wait_list,
|
|
||||||
const cl_event * event_wait_list,
|
|
||||||
cl_event * event) CL_EXT_SUFFIX__VERSION_1_2;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /*extern "C"*/
|
} /*extern "C"*/
|
||||||
|
|||||||
+2294
-2722
File diff suppressed because it is too large
Load Diff
@@ -4,69 +4,58 @@
|
|||||||
|
|
||||||
#include "cl_common.hpp"
|
#include "cl_common.hpp"
|
||||||
|
|
||||||
RUNTIME_ENTRY_RET(cl_key_amd, clCreateKeyAMD, (
|
RUNTIME_ENTRY_RET(cl_key_amd, clCreateKeyAMD,
|
||||||
cl_platform_id platform,
|
(cl_platform_id platform, void(CL_CALLBACK* destructor)(void*),
|
||||||
void (CL_CALLBACK * destructor)( void* ),
|
cl_int* errcode_ret)) {
|
||||||
cl_int *errcode_ret))
|
cl_key_amd key = amd::ObjectMetadata::createKey(destructor);
|
||||||
{
|
|
||||||
cl_key_amd key = amd::ObjectMetadata::createKey(destructor);
|
|
||||||
|
|
||||||
*not_null(errcode_ret) = amd::ObjectMetadata::check(key)
|
*not_null(errcode_ret) = amd::ObjectMetadata::check(key) ? CL_SUCCESS : CL_OUT_OF_RESOURCES;
|
||||||
? CL_SUCCESS : CL_OUT_OF_RESOURCES;
|
|
||||||
|
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
RUNTIME_ENTRY(cl_int, clObjectGetValueForKeyAMD, (
|
RUNTIME_ENTRY(cl_int, clObjectGetValueForKeyAMD, (void* object, cl_key_amd key, void** ret_val)) {
|
||||||
void * object,
|
if (ret_val == NULL) {
|
||||||
cl_key_amd key,
|
return CL_INVALID_VALUE;
|
||||||
void ** ret_val))
|
}
|
||||||
{
|
*ret_val = NULL;
|
||||||
if (ret_val == NULL) {
|
|
||||||
return CL_INVALID_VALUE;
|
|
||||||
}
|
|
||||||
*ret_val = NULL;
|
|
||||||
|
|
||||||
if (!amd::RuntimeObject::isValidHandle(object)) {
|
if (!amd::RuntimeObject::isValidHandle(object)) {
|
||||||
return CL_INVALID_OBJECT_AMD;
|
return CL_INVALID_OBJECT_AMD;
|
||||||
}
|
}
|
||||||
if (!amd::ObjectMetadata::check(key)) {
|
if (!amd::ObjectMetadata::check(key)) {
|
||||||
return CL_INVALID_KEY_AMD;
|
return CL_INVALID_KEY_AMD;
|
||||||
}
|
}
|
||||||
|
|
||||||
amd::ObjectMetadata& metadata =
|
amd::ObjectMetadata& metadata =
|
||||||
amd::RuntimeObject::fromHandle<amd::RuntimeObject>(object)->metadata();
|
amd::RuntimeObject::fromHandle<amd::RuntimeObject>(object)->metadata();
|
||||||
|
|
||||||
void* value = metadata.getValueForKey(key);
|
void* value = metadata.getValueForKey(key);
|
||||||
if (value == NULL) {
|
if (value == NULL) {
|
||||||
return CL_INVALID_KEY_AMD;
|
return CL_INVALID_KEY_AMD;
|
||||||
}
|
}
|
||||||
|
|
||||||
*ret_val = value;
|
*ret_val = value;
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
RUNTIME_ENTRY(cl_int, clObjectSetValueForKeyAMD, (
|
RUNTIME_ENTRY(cl_int, clObjectSetValueForKeyAMD, (void* object, cl_key_amd key, void* value)) {
|
||||||
void * object,
|
if (!amd::RuntimeObject::isValidHandle(object)) {
|
||||||
cl_key_amd key,
|
return CL_INVALID_OBJECT_AMD;
|
||||||
void * value))
|
}
|
||||||
{
|
if (!amd::ObjectMetadata::check(key)) {
|
||||||
if (!amd::RuntimeObject::isValidHandle(object)) {
|
return CL_INVALID_KEY_AMD;
|
||||||
return CL_INVALID_OBJECT_AMD;
|
}
|
||||||
}
|
if (value == NULL) {
|
||||||
if (!amd::ObjectMetadata::check(key)) {
|
return CL_INVALID_VALUE;
|
||||||
return CL_INVALID_KEY_AMD;
|
}
|
||||||
}
|
|
||||||
if (value == NULL) {
|
|
||||||
return CL_INVALID_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::ObjectMetadata& metadata =
|
amd::ObjectMetadata& metadata =
|
||||||
amd::RuntimeObject::fromHandle<amd::RuntimeObject>(object)->metadata();
|
amd::RuntimeObject::fromHandle<amd::RuntimeObject>(object)->metadata();
|
||||||
|
|
||||||
metadata.setValueForKey(key, value);
|
metadata.setValueForKey(key, value);
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|||||||
@@ -57,67 +57,62 @@
|
|||||||
*
|
*
|
||||||
* \version 2.0r19
|
* \version 2.0r19
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY_RET(cl_mem, clCreatePipe, (
|
RUNTIME_ENTRY_RET(cl_mem, clCreatePipe,
|
||||||
cl_context context,
|
(cl_context context, cl_mem_flags flags, cl_uint pipe_packet_size,
|
||||||
cl_mem_flags flags,
|
cl_uint pipe_max_packets, const cl_pipe_properties* properties,
|
||||||
cl_uint pipe_packet_size,
|
cl_int* errcode_ret)) {
|
||||||
cl_uint pipe_max_packets,
|
if (!is_valid(context)) {
|
||||||
const cl_pipe_properties *properties,
|
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
|
||||||
cl_int *errcode_ret))
|
return NULL;
|
||||||
{
|
}
|
||||||
if (!is_valid(context)) {
|
|
||||||
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
|
// check flags for validity
|
||||||
return NULL;
|
cl_bitfield temp =
|
||||||
|
flags & (CL_MEM_READ_WRITE | CL_MEM_WRITE_ONLY | CL_MEM_READ_ONLY | CL_MEM_HOST_NO_ACCESS);
|
||||||
|
|
||||||
|
if (temp &&
|
||||||
|
!(CL_MEM_READ_WRITE == temp || CL_MEM_WRITE_ONLY == temp || CL_MEM_READ_ONLY == temp ||
|
||||||
|
CL_MEM_HOST_NO_ACCESS == temp)) {
|
||||||
|
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||||
|
LogWarning("invalid parameter \"flags\"");
|
||||||
|
return (cl_mem)0;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t size = sizeof(struct clk_pipe_t) + pipe_packet_size * pipe_max_packets;
|
||||||
|
|
||||||
|
const std::vector<amd::Device*>& devices = as_amd(context)->devices();
|
||||||
|
std::vector<amd::Device*>::const_iterator it;
|
||||||
|
bool sizePass = false;
|
||||||
|
for (it = devices.begin(); it != devices.end(); ++it) {
|
||||||
|
if (((*it)->info().maxMemAllocSize_ >= size)) {
|
||||||
|
sizePass = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// check flags for validity
|
// check size
|
||||||
cl_bitfield temp = flags
|
if (pipe_packet_size == 0 || pipe_max_packets == 0 || !sizePass) {
|
||||||
& (CL_MEM_READ_WRITE | CL_MEM_WRITE_ONLY | CL_MEM_READ_ONLY | CL_MEM_HOST_NO_ACCESS);
|
*not_null(errcode_ret) = CL_INVALID_PIPE_SIZE;
|
||||||
|
LogWarning("invalid parameter \"size = 0 or size > CL_DEVICE_PIPE_MAX_PACKET_SIZE\"");
|
||||||
|
return (cl_mem)0;
|
||||||
|
}
|
||||||
|
|
||||||
if(temp
|
amd::Context& amdContext = *as_amd(context);
|
||||||
&& !(CL_MEM_READ_WRITE == temp
|
amd::Memory* mem = new (amdContext)
|
||||||
|| CL_MEM_WRITE_ONLY == temp
|
amd::Pipe(amdContext, flags, size, (size_t)pipe_packet_size, (size_t)pipe_max_packets);
|
||||||
|| CL_MEM_READ_ONLY == temp
|
if (mem == NULL) {
|
||||||
|| CL_MEM_HOST_NO_ACCESS == temp)) {
|
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
|
||||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
return (cl_mem)0;
|
||||||
LogWarning("invalid parameter \"flags\"");
|
}
|
||||||
return (cl_mem) 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t size = sizeof(struct clk_pipe_t) + pipe_packet_size * pipe_max_packets;
|
if (!mem->create()) {
|
||||||
|
*not_null(errcode_ret) = CL_MEM_OBJECT_ALLOCATION_FAILURE;
|
||||||
|
mem->release();
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
const std::vector<amd::Device*>& devices = as_amd(context)->devices();
|
*not_null(errcode_ret) = CL_SUCCESS;
|
||||||
std::vector<amd::Device*>::const_iterator it;
|
return as_cl(mem);
|
||||||
bool sizePass = false;
|
|
||||||
for (it = devices.begin(); it != devices.end(); ++it) {
|
|
||||||
if (((*it)->info().maxMemAllocSize_ >= size)) {
|
|
||||||
sizePass = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// check size
|
|
||||||
if (pipe_packet_size == 0 || pipe_max_packets == 0 || !sizePass ) {
|
|
||||||
*not_null(errcode_ret) = CL_INVALID_PIPE_SIZE;
|
|
||||||
LogWarning("invalid parameter \"size = 0 or size > CL_DEVICE_PIPE_MAX_PACKET_SIZE\"");
|
|
||||||
return (cl_mem)0;
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::Context& amdContext = *as_amd(context);
|
|
||||||
amd::Memory* mem = new(amdContext) amd::Pipe(amdContext, flags, size, (size_t)pipe_packet_size, (size_t)pipe_max_packets);
|
|
||||||
if (mem == NULL) {
|
|
||||||
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
|
|
||||||
return (cl_mem)0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mem->create()) {
|
|
||||||
*not_null(errcode_ret) = CL_MEM_OBJECT_ALLOCATION_FAILURE;
|
|
||||||
mem->release();
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
*not_null(errcode_ret) = CL_SUCCESS;
|
|
||||||
return as_cl(mem);
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -141,44 +136,37 @@ RUNTIME_EXIT
|
|||||||
* - CL_INVALID_MEM_OBJECT if pipe is a not a valid pipe object.
|
* - CL_INVALID_MEM_OBJECT if pipe is a not a valid pipe object.
|
||||||
* - CL_OUT_OF_RESOURCES if there is a failure to allocate resources required
|
* - CL_OUT_OF_RESOURCES if there is a failure to allocate resources required
|
||||||
* by the OpenCL implementation on the device.
|
* by the OpenCL implementation on the device.
|
||||||
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required
|
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required
|
||||||
* by the OpenCL implementation on the host.
|
* by the OpenCL implementation on the host.
|
||||||
*
|
*
|
||||||
* \version 2.0r19
|
* \version 2.0r19
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clGetPipeInfo, (
|
RUNTIME_ENTRY(cl_int, clGetPipeInfo,
|
||||||
cl_mem memobj,
|
(cl_mem memobj, cl_image_info param_name, size_t param_value_size, void* param_value,
|
||||||
cl_image_info param_name,
|
size_t* param_value_size_ret)) {
|
||||||
size_t param_value_size,
|
if (!is_valid(memobj)) {
|
||||||
void *param_value,
|
return CL_INVALID_MEM_OBJECT;
|
||||||
size_t *param_value_size_ret))
|
}
|
||||||
{
|
|
||||||
if (!is_valid(memobj)) {
|
|
||||||
return CL_INVALID_MEM_OBJECT;
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::Pipe* pipe = as_amd(memobj)->asPipe();
|
amd::Pipe* pipe = as_amd(memobj)->asPipe();
|
||||||
if (pipe == NULL) {
|
if (pipe == NULL) {
|
||||||
return CL_INVALID_MEM_OBJECT;
|
return CL_INVALID_MEM_OBJECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (param_name) {
|
switch (param_name) {
|
||||||
case CL_PIPE_PACKET_SIZE: {
|
case CL_PIPE_PACKET_SIZE: {
|
||||||
cl_uint packetSize = pipe->getPacketSize();
|
cl_uint packetSize = pipe->getPacketSize();
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(packetSize, param_value_size, param_value, param_value_size_ret);
|
||||||
packetSize, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
case CL_PIPE_MAX_PACKETS: {
|
case CL_PIPE_MAX_PACKETS: {
|
||||||
cl_uint count = pipe->getMaxNumPackets();
|
cl_uint count = pipe->getMaxNumPackets();
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(count, param_value_size, param_value, param_value_size_ret);
|
||||||
count, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CL_INVALID_VALUE;
|
|
||||||
|
|
||||||
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
|
|||||||
@@ -13,12 +13,11 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
RUNTIME_ENTRY(cl_int, clUnloadPlatformAMD, (cl_platform_id platform))
|
RUNTIME_ENTRY(cl_int, clUnloadPlatformAMD, (cl_platform_id platform)) {
|
||||||
{
|
if (AMD_PLATFORM == platform) {
|
||||||
if (AMD_PLATFORM == platform) {
|
amd::Runtime::tearDown();
|
||||||
amd::Runtime::tearDown();
|
}
|
||||||
}
|
return CL_SUCCESS;
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
|
|||||||
@@ -103,15 +103,15 @@ extern "C" {
|
|||||||
|
|
||||||
/*! \brief Unloads the specified platform, handling all required cleanup.
|
/*! \brief Unloads the specified platform, handling all required cleanup.
|
||||||
*
|
*
|
||||||
* @todo This is still somewhat of a stub. It only works for the AMD
|
* @todo This is still somewhat of a stub. It only works for the AMD
|
||||||
* platform and just forces shutdown of all devices (to get PM4
|
* platform and just forces shutdown of all devices (to get PM4
|
||||||
* capture working). It should handle ICD unregistration as well.
|
* capture working). It should handle ICD unregistration as well.
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
extern CL_API_ENTRY cl_int CL_API_CALL clUnloadPlatformAMD(cl_platform_id platform)
|
||||||
clUnloadPlatformAMD(cl_platform_id platform) CL_API_SUFFIX__VERSION_1_0;
|
CL_API_SUFFIX__VERSION_1_0;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /*extern "C"*/
|
} /*extern "C"*/
|
||||||
#endif /*__cplusplus*/
|
#endif /*__cplusplus*/
|
||||||
|
|
||||||
#endif /*__CL_AMD_PROFILE_H*/
|
#endif /*__CL_AMD_PROFILE_H*/
|
||||||
|
|||||||
@@ -38,46 +38,40 @@
|
|||||||
*
|
*
|
||||||
* \return Created perfcounter object
|
* \return Created perfcounter object
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY_RET(cl_perfcounter_amd, clCreatePerfCounterAMD, (
|
RUNTIME_ENTRY_RET(cl_perfcounter_amd, clCreatePerfCounterAMD,
|
||||||
cl_device_id device,
|
(cl_device_id device, cl_perfcounter_property* properties, cl_int* errcode_ret)) {
|
||||||
cl_perfcounter_property* properties,
|
// Make sure we have a valid device object
|
||||||
cl_int* errcode_ret))
|
if (!is_valid(device)) {
|
||||||
{
|
*not_null(errcode_ret) = CL_INVALID_DEVICE;
|
||||||
// Make sure we have a valid device object
|
return NULL;
|
||||||
if (!is_valid(device)) {
|
}
|
||||||
*not_null(errcode_ret) = CL_INVALID_DEVICE;
|
|
||||||
return NULL;
|
// Make sure we have a valid pointer to the performance counter properties
|
||||||
|
if (NULL == properties) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
amd::PerfCounter::Properties perfProperties;
|
||||||
|
size_t size = 0;
|
||||||
|
while (properties[size] != CL_PERFCOUNTER_NONE) {
|
||||||
|
if (properties[size] < CL_PERFCOUNTER_LAST) {
|
||||||
|
perfProperties[properties[size]] = static_cast<ulong>(properties[size + 1]);
|
||||||
|
size += 2;
|
||||||
|
} else {
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure we have a valid pointer to the performance counter properties
|
// Create the device perf counter
|
||||||
if (NULL == properties) {
|
amd::PerfCounter* perfCounter = new amd::PerfCounter(*as_amd(device), perfProperties);
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::PerfCounter::Properties perfProperties;
|
if (perfCounter == NULL) {
|
||||||
size_t size = 0;
|
*not_null(errcode_ret) = CL_INVALID_OPERATION;
|
||||||
while (properties[size] != CL_PERFCOUNTER_NONE) {
|
return NULL;
|
||||||
if (properties[size] < CL_PERFCOUNTER_LAST) {
|
}
|
||||||
perfProperties[properties[size]] =
|
|
||||||
static_cast<ulong>(properties[size+1]);
|
|
||||||
size += 2;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the device perf counter
|
*not_null(errcode_ret) = CL_SUCCESS;
|
||||||
amd::PerfCounter* perfCounter =
|
return as_cl(perfCounter);
|
||||||
new amd::PerfCounter(*as_amd(device), perfProperties);
|
|
||||||
|
|
||||||
if (perfCounter == NULL) {
|
|
||||||
*not_null(errcode_ret) = CL_INVALID_OPERATION;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
*not_null(errcode_ret) = CL_SUCCESS;
|
|
||||||
return as_cl(perfCounter);
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -89,14 +83,12 @@ RUNTIME_EXIT
|
|||||||
* - CL_SUCCESS if the function is executed successfully.
|
* - CL_SUCCESS if the function is executed successfully.
|
||||||
* - CL_INVALID_OPERATION if we failed to release the object
|
* - CL_INVALID_OPERATION if we failed to release the object
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clReleasePerfCounterAMD, (
|
RUNTIME_ENTRY(cl_int, clReleasePerfCounterAMD, (cl_perfcounter_amd perf_counter)) {
|
||||||
cl_perfcounter_amd perf_counter))
|
if (!is_valid(perf_counter)) {
|
||||||
{
|
return CL_INVALID_OPERATION;
|
||||||
if (!is_valid(perf_counter)) {
|
}
|
||||||
return CL_INVALID_OPERATION;
|
as_amd(perf_counter)->release();
|
||||||
}
|
return CL_SUCCESS;
|
||||||
as_amd(perf_counter)->release();
|
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -108,14 +100,12 @@ RUNTIME_EXIT
|
|||||||
* - CL_SUCCESS if the function is executed successfully.
|
* - CL_SUCCESS if the function is executed successfully.
|
||||||
* - CL_INVALID_OPERATION if we failed to release the object
|
* - CL_INVALID_OPERATION if we failed to release the object
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clRetainPerfCounterAMD, (
|
RUNTIME_ENTRY(cl_int, clRetainPerfCounterAMD, (cl_perfcounter_amd perf_counter)) {
|
||||||
cl_perfcounter_amd perf_counter))
|
if (!is_valid(perf_counter)) {
|
||||||
{
|
return CL_INVALID_OPERATION;
|
||||||
if (!is_valid(perf_counter)) {
|
}
|
||||||
return CL_INVALID_OPERATION;
|
as_amd(perf_counter)->retain();
|
||||||
}
|
return CL_SUCCESS;
|
||||||
as_amd(perf_counter)->retain();
|
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -151,64 +141,58 @@ RUNTIME_EXIT
|
|||||||
* - CL_INVALID_OPERATION if we failed to enqueue the begin operation
|
* - CL_INVALID_OPERATION if we failed to enqueue the begin operation
|
||||||
* - CL_INVALID_COMMAND_QUEUE if the queue is
|
* - CL_INVALID_COMMAND_QUEUE if the queue is
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clEnqueueBeginPerfCounterAMD, (
|
RUNTIME_ENTRY(cl_int, clEnqueueBeginPerfCounterAMD,
|
||||||
cl_command_queue command_queue,
|
(cl_command_queue command_queue, cl_uint num_perf_counters,
|
||||||
cl_uint num_perf_counters,
|
cl_perfcounter_amd* perf_counters, cl_uint num_events_in_wait_list,
|
||||||
cl_perfcounter_amd* perf_counters,
|
const cl_event* event_wait_list, cl_event* event)) {
|
||||||
cl_uint num_events_in_wait_list,
|
if (!is_valid(command_queue)) {
|
||||||
const cl_event* event_wait_list,
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
cl_event* event))
|
}
|
||||||
{
|
|
||||||
if (!is_valid(command_queue)) {
|
if ((num_perf_counters == 0) || (perf_counters == NULL)) {
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
return CL_INVALID_OPERATION;
|
||||||
|
}
|
||||||
|
|
||||||
|
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
||||||
|
if (NULL == hostQueue) {
|
||||||
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
amd::PerfCounterCommand::PerfCounterList counters;
|
||||||
|
|
||||||
|
// Place all counters into the list
|
||||||
|
for (cl_uint i = 0; i < num_perf_counters; ++i) {
|
||||||
|
amd::PerfCounter* amdPerf = as_amd(perf_counters[i]);
|
||||||
|
if (&hostQueue->device() == &amdPerf->device()) {
|
||||||
|
counters.push_back(amdPerf);
|
||||||
|
} else {
|
||||||
|
return CL_INVALID_DEVICE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((num_perf_counters == 0) || (perf_counters == NULL)) {
|
amd::Command::EventWaitList eventWaitList;
|
||||||
return CL_INVALID_OPERATION;
|
cl_int err = amd::clSetEventWaitList(eventWaitList, hostQueue->context(), num_events_in_wait_list,
|
||||||
}
|
event_wait_list);
|
||||||
|
if (err != CL_SUCCESS) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
// Create a new command for the performance counters
|
||||||
if (NULL == hostQueue) {
|
amd::PerfCounterCommand* command = new amd::PerfCounterCommand(
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
*hostQueue, eventWaitList, counters, amd::PerfCounterCommand::Begin);
|
||||||
}
|
if (command == NULL) {
|
||||||
|
return CL_OUT_OF_HOST_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
amd::PerfCounterCommand::PerfCounterList counters;
|
// Submit the command to the device
|
||||||
|
command->enqueue();
|
||||||
|
|
||||||
// Place all counters into the list
|
*not_null(event) = as_cl(&command->event());
|
||||||
for (cl_uint i = 0; i < num_perf_counters; ++i) {
|
if (event == NULL) {
|
||||||
amd::PerfCounter* amdPerf = as_amd(perf_counters[i]);
|
command->release();
|
||||||
if (&hostQueue->device() == &amdPerf->device()) {
|
}
|
||||||
counters.push_back(amdPerf);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return CL_INVALID_DEVICE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::Command::EventWaitList eventWaitList;
|
return CL_SUCCESS;
|
||||||
cl_int err = amd::clSetEventWaitList(eventWaitList,
|
|
||||||
hostQueue->context(), num_events_in_wait_list, event_wait_list);
|
|
||||||
if (err != CL_SUCCESS){
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a new command for the performance counters
|
|
||||||
amd::PerfCounterCommand* command =
|
|
||||||
new amd::PerfCounterCommand(*hostQueue, eventWaitList, counters,
|
|
||||||
amd::PerfCounterCommand::Begin);
|
|
||||||
if (command == NULL) {
|
|
||||||
return CL_OUT_OF_HOST_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Submit the command to the device
|
|
||||||
command->enqueue();
|
|
||||||
|
|
||||||
*not_null(event) = as_cl(&command->event());
|
|
||||||
if (event == NULL) {
|
|
||||||
command->release();
|
|
||||||
}
|
|
||||||
|
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -243,64 +227,58 @@ RUNTIME_EXIT
|
|||||||
* - CL_SUCCESS if the function is executed successfully.
|
* - CL_SUCCESS if the function is executed successfully.
|
||||||
* - CL_INVALID_OPERATION if we failed to enqueue the end operation
|
* - CL_INVALID_OPERATION if we failed to enqueue the end operation
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clEnqueueEndPerfCounterAMD, (
|
RUNTIME_ENTRY(cl_int, clEnqueueEndPerfCounterAMD,
|
||||||
cl_command_queue command_queue,
|
(cl_command_queue command_queue, cl_uint num_perf_counters,
|
||||||
cl_uint num_perf_counters,
|
cl_perfcounter_amd* perf_counters, cl_uint num_events_in_wait_list,
|
||||||
cl_perfcounter_amd* perf_counters,
|
const cl_event* event_wait_list, cl_event* event)) {
|
||||||
cl_uint num_events_in_wait_list,
|
if (!is_valid(command_queue)) {
|
||||||
const cl_event* event_wait_list,
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
cl_event* event))
|
}
|
||||||
{
|
|
||||||
if (!is_valid(command_queue)) {
|
if ((num_perf_counters == 0) || (perf_counters == NULL)) {
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
return CL_INVALID_OPERATION;
|
||||||
|
}
|
||||||
|
|
||||||
|
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
||||||
|
if (NULL == hostQueue) {
|
||||||
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
amd::PerfCounterCommand::PerfCounterList counters;
|
||||||
|
|
||||||
|
// Place all counters into the list
|
||||||
|
for (cl_uint i = 0; i < num_perf_counters; ++i) {
|
||||||
|
amd::PerfCounter* amdPerf = as_amd(perf_counters[i]);
|
||||||
|
if (&hostQueue->device() == &amdPerf->device()) {
|
||||||
|
counters.push_back(amdPerf);
|
||||||
|
} else {
|
||||||
|
return CL_INVALID_DEVICE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((num_perf_counters == 0) || (perf_counters == NULL)) {
|
amd::Command::EventWaitList eventWaitList;
|
||||||
return CL_INVALID_OPERATION;
|
cl_int err = amd::clSetEventWaitList(eventWaitList, hostQueue->context(), num_events_in_wait_list,
|
||||||
}
|
event_wait_list);
|
||||||
|
if (err != CL_SUCCESS) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
// Create a new command for the performance counters
|
||||||
if (NULL == hostQueue) {
|
amd::PerfCounterCommand* command = new amd::PerfCounterCommand(
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
*hostQueue, eventWaitList, counters, amd::PerfCounterCommand::End);
|
||||||
}
|
if (command == NULL) {
|
||||||
|
return CL_OUT_OF_HOST_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
amd::PerfCounterCommand::PerfCounterList counters;
|
// Submit the command to the device
|
||||||
|
command->enqueue();
|
||||||
|
|
||||||
// Place all counters into the list
|
*not_null(event) = as_cl(&command->event());
|
||||||
for (cl_uint i = 0; i < num_perf_counters; ++i) {
|
if (event == NULL) {
|
||||||
amd::PerfCounter* amdPerf = as_amd(perf_counters[i]);
|
command->release();
|
||||||
if (&hostQueue->device() == &amdPerf->device()) {
|
}
|
||||||
counters.push_back(amdPerf);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return CL_INVALID_DEVICE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::Command::EventWaitList eventWaitList;
|
return CL_SUCCESS;
|
||||||
cl_int err = amd::clSetEventWaitList(eventWaitList,
|
|
||||||
hostQueue->context(), num_events_in_wait_list, event_wait_list);
|
|
||||||
if (err != CL_SUCCESS){
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a new command for the performance counters
|
|
||||||
amd::PerfCounterCommand* command =
|
|
||||||
new amd::PerfCounterCommand(*hostQueue, eventWaitList, counters,
|
|
||||||
amd::PerfCounterCommand::End);
|
|
||||||
if (command == NULL) {
|
|
||||||
return CL_OUT_OF_HOST_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Submit the command to the device
|
|
||||||
command->enqueue();
|
|
||||||
|
|
||||||
*not_null(event) = as_cl(&command->event());
|
|
||||||
if (event == NULL) {
|
|
||||||
command->release();
|
|
||||||
}
|
|
||||||
|
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -323,57 +301,49 @@ RUNTIME_EXIT
|
|||||||
* - CL_PROFILING_INFO_NOT_AVAILABLE if event isn't finished.
|
* - CL_PROFILING_INFO_NOT_AVAILABLE if event isn't finished.
|
||||||
* - CL_INVALID_OPERATION if we failed to get the data
|
* - CL_INVALID_OPERATION if we failed to get the data
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clGetPerfCounterInfoAMD, (
|
RUNTIME_ENTRY(cl_int, clGetPerfCounterInfoAMD,
|
||||||
cl_perfcounter_amd perf_counter,
|
(cl_perfcounter_amd perf_counter, cl_perfcounter_info param_name,
|
||||||
cl_perfcounter_info param_name,
|
size_t param_value_size, void* param_value, size_t* param_value_size_ret)) {
|
||||||
size_t param_value_size,
|
// Check if we have a valid performance counter
|
||||||
void* param_value,
|
if (!is_valid(perf_counter)) {
|
||||||
size_t* param_value_size_ret))
|
return CL_INVALID_OPERATION;
|
||||||
{
|
}
|
||||||
// Check if we have a valid performance counter
|
|
||||||
if (!is_valid(perf_counter)) {
|
|
||||||
return CL_INVALID_OPERATION;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find the kernel, associated with the specified device
|
// Find the kernel, associated with the specified device
|
||||||
const device::PerfCounter* devCounter =
|
const device::PerfCounter* devCounter = as_amd(perf_counter)->getDeviceCounter();
|
||||||
as_amd(perf_counter)->getDeviceCounter();
|
|
||||||
|
|
||||||
// Make sure we found a valid performance counter
|
// Make sure we found a valid performance counter
|
||||||
if (devCounter == NULL) {
|
if (devCounter == NULL) {
|
||||||
return CL_INVALID_OPERATION;
|
return CL_INVALID_OPERATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the corresponded parameters
|
// Get the corresponded parameters
|
||||||
switch (param_name) {
|
switch (param_name) {
|
||||||
case CL_PERFCOUNTER_REFERENCE_COUNT: {
|
case CL_PERFCOUNTER_REFERENCE_COUNT: {
|
||||||
cl_uint count = as_amd(perf_counter)->referenceCount();
|
cl_uint count = as_amd(perf_counter)->referenceCount();
|
||||||
// Return the reference counter
|
// Return the reference counter
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(count, param_value_size, param_value, param_value_size_ret);
|
||||||
count, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
case CL_PERFCOUNTER_GPU_BLOCK_INDEX:
|
case CL_PERFCOUNTER_GPU_BLOCK_INDEX:
|
||||||
case CL_PERFCOUNTER_GPU_COUNTER_INDEX:
|
case CL_PERFCOUNTER_GPU_COUNTER_INDEX:
|
||||||
case CL_PERFCOUNTER_GPU_EVENT_INDEX: {
|
case CL_PERFCOUNTER_GPU_EVENT_INDEX: {
|
||||||
cl_ulong data = devCounter->getInfo(param_name);
|
cl_ulong data = devCounter->getInfo(param_name);
|
||||||
// Return the device performance counter information
|
// Return the device performance counter information
|
||||||
return amd::clGetInfo(data,
|
return amd::clGetInfo(data, param_value_size, param_value, param_value_size_ret);
|
||||||
param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
case CL_PERFCOUNTER_DATA: {
|
case CL_PERFCOUNTER_DATA: {
|
||||||
cl_ulong data = devCounter->getInfo(param_name);
|
cl_ulong data = devCounter->getInfo(param_name);
|
||||||
if (static_cast<cl_ulong>(0xffffffffffffffffULL) == data) {
|
if (static_cast<cl_ulong>(0xffffffffffffffffULL) == data) {
|
||||||
return CL_PROFILING_INFO_NOT_AVAILABLE;
|
return CL_PROFILING_INFO_NOT_AVAILABLE;
|
||||||
}
|
}
|
||||||
// Return the device performance counter result
|
// Return the device performance counter result
|
||||||
return amd::clGetInfo(data,
|
return amd::clGetInfo(data, param_value_size, param_value, param_value_size_ret);
|
||||||
param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
|
|||||||
@@ -99,20 +99,19 @@ jurisdiction and venue of these courts.
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /*__cplusplus*/
|
#endif /*__cplusplus*/
|
||||||
|
|
||||||
typedef struct _cl_perfcounter_amd * cl_perfcounter_amd;
|
typedef struct _cl_perfcounter_amd* cl_perfcounter_amd;
|
||||||
typedef cl_ulong cl_perfcounter_property;
|
typedef cl_ulong cl_perfcounter_property;
|
||||||
typedef cl_uint cl_perfcounter_info;
|
typedef cl_uint cl_perfcounter_info;
|
||||||
|
|
||||||
/* cl_perfcounter_info */
|
/* cl_perfcounter_info */
|
||||||
enum PerfcounterInfo
|
enum PerfcounterInfo {
|
||||||
{
|
CL_PERFCOUNTER_NONE = 0x0,
|
||||||
CL_PERFCOUNTER_NONE = 0x0,
|
CL_PERFCOUNTER_REFERENCE_COUNT = 0x1,
|
||||||
CL_PERFCOUNTER_REFERENCE_COUNT = 0x1,
|
CL_PERFCOUNTER_DATA = 0x2,
|
||||||
CL_PERFCOUNTER_DATA = 0x2,
|
CL_PERFCOUNTER_GPU_BLOCK_INDEX = 0x3,
|
||||||
CL_PERFCOUNTER_GPU_BLOCK_INDEX = 0x3,
|
CL_PERFCOUNTER_GPU_COUNTER_INDEX = 0x4,
|
||||||
CL_PERFCOUNTER_GPU_COUNTER_INDEX = 0x4,
|
CL_PERFCOUNTER_GPU_EVENT_INDEX = 0x5,
|
||||||
CL_PERFCOUNTER_GPU_EVENT_INDEX = 0x5,
|
CL_PERFCOUNTER_LAST
|
||||||
CL_PERFCOUNTER_LAST
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! \brief Creates a new HW performance counter
|
/*! \brief Creates a new HW performance counter
|
||||||
@@ -129,12 +128,9 @@ enum PerfcounterInfo
|
|||||||
*
|
*
|
||||||
* \return the created perfcounter object
|
* \return the created perfcounter object
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_perfcounter_amd CL_API_CALL
|
extern CL_API_ENTRY cl_perfcounter_amd CL_API_CALL clCreatePerfCounterAMD(
|
||||||
clCreatePerfCounterAMD(
|
cl_device_id /* device */, cl_perfcounter_property* /* properties */, cl_int* /* errcode_ret */
|
||||||
cl_device_id /* device */,
|
) CL_API_SUFFIX__VERSION_1_0;
|
||||||
cl_perfcounter_property* /* properties */,
|
|
||||||
cl_int* /* errcode_ret */
|
|
||||||
) CL_API_SUFFIX__VERSION_1_0;
|
|
||||||
|
|
||||||
/*! \brief Destroy a performance counter object.
|
/*! \brief Destroy a performance counter object.
|
||||||
*
|
*
|
||||||
@@ -144,10 +140,8 @@ clCreatePerfCounterAMD(
|
|||||||
* - CL_SUCCESS if the function is executed successfully.
|
* - CL_SUCCESS if the function is executed successfully.
|
||||||
* - CL_INVALID_OPERATION if we failed to release the object
|
* - CL_INVALID_OPERATION if we failed to release the object
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
extern CL_API_ENTRY cl_int CL_API_CALL clReleasePerfCounterAMD(cl_perfcounter_amd /* perf_counter */
|
||||||
clReleasePerfCounterAMD(
|
) CL_API_SUFFIX__VERSION_1_0;
|
||||||
cl_perfcounter_amd /* perf_counter */
|
|
||||||
) CL_API_SUFFIX__VERSION_1_0;
|
|
||||||
|
|
||||||
/*! \brief Increments the perfcounter object reference count.
|
/*! \brief Increments the perfcounter object reference count.
|
||||||
*
|
*
|
||||||
@@ -157,10 +151,8 @@ clReleasePerfCounterAMD(
|
|||||||
* - CL_SUCCESS if the function is executed successfully.
|
* - CL_SUCCESS if the function is executed successfully.
|
||||||
* - CL_INVALID_OPERATION if we failed to release the object
|
* - CL_INVALID_OPERATION if we failed to release the object
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
extern CL_API_ENTRY cl_int CL_API_CALL clRetainPerfCounterAMD(cl_perfcounter_amd /* perf_counter */
|
||||||
clRetainPerfCounterAMD(
|
) CL_API_SUFFIX__VERSION_1_0;
|
||||||
cl_perfcounter_amd /* perf_counter */
|
|
||||||
) CL_API_SUFFIX__VERSION_1_0;
|
|
||||||
|
|
||||||
/*! \brief Enqueues the begin command for the specified counters.
|
/*! \brief Enqueues the begin command for the specified counters.
|
||||||
*
|
*
|
||||||
@@ -174,15 +166,11 @@ clRetainPerfCounterAMD(
|
|||||||
* - CL_SUCCESS if the function is executed successfully.
|
* - CL_SUCCESS if the function is executed successfully.
|
||||||
* - CL_INVALID_OPERATION if we failed to enqueue the begin operation
|
* - CL_INVALID_OPERATION if we failed to enqueue the begin operation
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueBeginPerfCounterAMD(
|
||||||
clEnqueueBeginPerfCounterAMD(
|
cl_command_queue /* command_queue */, cl_uint /* num_perf_counters */,
|
||||||
cl_command_queue /* command_queue */,
|
cl_perfcounter_amd* /* perf_counters */, cl_uint /* num_events_in_wait_list */,
|
||||||
cl_uint /* num_perf_counters */,
|
const cl_event* /* event_wait_list */, cl_event* /* event */
|
||||||
cl_perfcounter_amd* /* perf_counters */,
|
) CL_API_SUFFIX__VERSION_1_0;
|
||||||
cl_uint /* num_events_in_wait_list */,
|
|
||||||
const cl_event* /* event_wait_list */,
|
|
||||||
cl_event* /* event */
|
|
||||||
) CL_API_SUFFIX__VERSION_1_0;
|
|
||||||
|
|
||||||
/*! \brief Enqueues the end command for the specified counters.
|
/*! \brief Enqueues the end command for the specified counters.
|
||||||
*
|
*
|
||||||
@@ -198,15 +186,11 @@ clEnqueueBeginPerfCounterAMD(
|
|||||||
* - CL_SUCCESS if the function is executed successfully.
|
* - CL_SUCCESS if the function is executed successfully.
|
||||||
* - CL_INVALID_OPERATION if we failed to enqueue the end operation
|
* - CL_INVALID_OPERATION if we failed to enqueue the end operation
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueEndPerfCounterAMD(
|
||||||
clEnqueueEndPerfCounterAMD(
|
cl_command_queue /* command_queue */, cl_uint /* num_perf_counters */,
|
||||||
cl_command_queue /* command_queue */,
|
cl_perfcounter_amd* /* perf_counters */, cl_uint /* num_events_in_wait_list */,
|
||||||
cl_uint /* num_perf_counters */,
|
const cl_event* /* event_wait_list */, cl_event* /* event */
|
||||||
cl_perfcounter_amd* /* perf_counters */,
|
) CL_API_SUFFIX__VERSION_1_0;
|
||||||
cl_uint /* num_events_in_wait_list */,
|
|
||||||
const cl_event* /* event_wait_list */,
|
|
||||||
cl_event* /* event */
|
|
||||||
) CL_API_SUFFIX__VERSION_1_0;
|
|
||||||
|
|
||||||
/*! \brief Retrieves the results from the counter objects.
|
/*! \brief Retrieves the results from the counter objects.
|
||||||
*
|
*
|
||||||
@@ -231,17 +215,13 @@ clEnqueueEndPerfCounterAMD(
|
|||||||
* - CL_PROFILING_INFO_NOT_AVAILABLE if event isn't finished.
|
* - CL_PROFILING_INFO_NOT_AVAILABLE if event isn't finished.
|
||||||
* - CL_INVALID_OPERATION if we failed to get the data
|
* - CL_INVALID_OPERATION if we failed to get the data
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
extern CL_API_ENTRY cl_int CL_API_CALL clGetPerfCounterInfoAMD(
|
||||||
clGetPerfCounterInfoAMD(
|
cl_perfcounter_amd /* perf_counter */, cl_perfcounter_info /* param_name */,
|
||||||
cl_perfcounter_amd /* perf_counter */,
|
size_t /* param_value_size */, void* /* param_value */, size_t* /* param_value_size_ret */
|
||||||
cl_perfcounter_info /* param_name */,
|
) CL_API_SUFFIX__VERSION_1_0;
|
||||||
size_t /* param_value_size */,
|
|
||||||
void* /* param_value */,
|
|
||||||
size_t* /* param_value_size_ret */
|
|
||||||
) CL_API_SUFFIX__VERSION_1_0;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /*extern "C"*/
|
} /*extern "C"*/
|
||||||
#endif /*__cplusplus*/
|
#endif /*__cplusplus*/
|
||||||
|
|
||||||
#endif /*__CL_PROFILE_AMD_H*/
|
#endif /*__CL_PROFILE_AMD_H*/
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -52,138 +52,133 @@
|
|||||||
*
|
*
|
||||||
* \version 2.0r19
|
* \version 2.0r19
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY_RET(cl_sampler, clCreateSamplerWithProperties, (
|
RUNTIME_ENTRY_RET(cl_sampler, clCreateSamplerWithProperties,
|
||||||
cl_context context,
|
(cl_context context, const cl_sampler_properties* sampler_properties,
|
||||||
const cl_sampler_properties *sampler_properties,
|
cl_int* errcode_ret)) {
|
||||||
cl_int *errcode_ret))
|
if (!is_valid(context)) {
|
||||||
{
|
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
|
||||||
if(!is_valid(context)) {
|
LogWarning("invalid parameter \"context\"");
|
||||||
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
|
return (cl_sampler)0;
|
||||||
LogWarning("invalid parameter \"context\"");
|
}
|
||||||
return (cl_sampler) 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
cl_bool normalizedCoords = CL_TRUE;
|
cl_bool normalizedCoords = CL_TRUE;
|
||||||
cl_addressing_mode addressingMode = CL_ADDRESS_CLAMP;
|
cl_addressing_mode addressingMode = CL_ADDRESS_CLAMP;
|
||||||
cl_filter_mode filterMode = CL_FILTER_NEAREST;
|
cl_filter_mode filterMode = CL_FILTER_NEAREST;
|
||||||
#ifndef CL_FILTER_NONE
|
#ifndef CL_FILTER_NONE
|
||||||
#define CL_FILTER_NONE 0x1142
|
#define CL_FILTER_NONE 0x1142
|
||||||
#endif
|
#endif
|
||||||
cl_filter_mode mipFilterMode = CL_FILTER_NONE;
|
cl_filter_mode mipFilterMode = CL_FILTER_NONE;
|
||||||
float minLod = 0.f;
|
float minLod = 0.f;
|
||||||
float maxLod = CL_MAXFLOAT;
|
float maxLod = CL_MAXFLOAT;
|
||||||
|
|
||||||
const struct SamplerProperty {
|
const struct SamplerProperty {
|
||||||
cl_sampler_properties name;
|
cl_sampler_properties name;
|
||||||
union {
|
union {
|
||||||
cl_sampler_properties raw;
|
cl_sampler_properties raw;
|
||||||
cl_bool normalizedCoords;
|
cl_bool normalizedCoords;
|
||||||
cl_addressing_mode addressingMode;
|
cl_addressing_mode addressingMode;
|
||||||
cl_filter_mode filterMode;
|
cl_filter_mode filterMode;
|
||||||
cl_float lod;
|
cl_float lod;
|
||||||
} value;
|
} value;
|
||||||
} *p = reinterpret_cast<const SamplerProperty*>(sampler_properties);
|
}* p = reinterpret_cast<const SamplerProperty*>(sampler_properties);
|
||||||
|
|
||||||
if (p != NULL) while(p->name != 0) {
|
if (p != NULL)
|
||||||
switch(p->name) {
|
while (p->name != 0) {
|
||||||
|
switch (p->name) {
|
||||||
case CL_SAMPLER_NORMALIZED_COORDS:
|
case CL_SAMPLER_NORMALIZED_COORDS:
|
||||||
normalizedCoords = p->value.normalizedCoords;
|
normalizedCoords = p->value.normalizedCoords;
|
||||||
break;
|
break;
|
||||||
case CL_SAMPLER_ADDRESSING_MODE:
|
case CL_SAMPLER_ADDRESSING_MODE:
|
||||||
addressingMode = p->value.addressingMode;
|
addressingMode = p->value.addressingMode;
|
||||||
break;
|
break;
|
||||||
case CL_SAMPLER_FILTER_MODE:
|
case CL_SAMPLER_FILTER_MODE:
|
||||||
filterMode = p->value.filterMode;
|
filterMode = p->value.filterMode;
|
||||||
break;
|
break;
|
||||||
case CL_SAMPLER_MIP_FILTER_MODE:
|
case CL_SAMPLER_MIP_FILTER_MODE:
|
||||||
mipFilterMode = p->value.filterMode;
|
mipFilterMode = p->value.filterMode;
|
||||||
break;
|
break;
|
||||||
case CL_SAMPLER_LOD_MIN:
|
case CL_SAMPLER_LOD_MIN:
|
||||||
minLod = p->value.lod;
|
minLod = p->value.lod;
|
||||||
break;
|
break;
|
||||||
case CL_SAMPLER_LOD_MAX:
|
case CL_SAMPLER_LOD_MAX:
|
||||||
maxLod = p->value.lod;
|
maxLod = p->value.lod;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||||
LogWarning("invalid property name");
|
LogWarning("invalid property name");
|
||||||
return (cl_sampler) 0;
|
return (cl_sampler)0;
|
||||||
}
|
}
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check sampler validity
|
// Check sampler validity
|
||||||
// Check addressing mode
|
// Check addressing mode
|
||||||
switch (addressingMode) {
|
switch (addressingMode) {
|
||||||
case CL_ADDRESS_NONE:
|
case CL_ADDRESS_NONE:
|
||||||
case CL_ADDRESS_CLAMP_TO_EDGE:
|
case CL_ADDRESS_CLAMP_TO_EDGE:
|
||||||
case CL_ADDRESS_CLAMP:
|
case CL_ADDRESS_CLAMP:
|
||||||
break;
|
break;
|
||||||
case CL_ADDRESS_REPEAT:
|
case CL_ADDRESS_REPEAT:
|
||||||
if (!normalizedCoords) {
|
if (!normalizedCoords) {
|
||||||
// repeat mode cannot be used with unnormalized coordinates
|
// repeat mode cannot be used with unnormalized coordinates
|
||||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||||
LogWarning("invalid combination for sampler");
|
LogWarning("invalid combination for sampler");
|
||||||
return (cl_sampler) 0;
|
return (cl_sampler)0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CL_ADDRESS_MIRRORED_REPEAT:
|
case CL_ADDRESS_MIRRORED_REPEAT:
|
||||||
if (!normalizedCoords) {
|
if (!normalizedCoords) {
|
||||||
// repeat mode cannot be used with unnormalized coordinates
|
// repeat mode cannot be used with unnormalized coordinates
|
||||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||||
LogWarning("invalid combination for sampler");
|
LogWarning("invalid combination for sampler");
|
||||||
return (cl_sampler) 0;
|
return (cl_sampler)0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||||
LogWarning("invalid addressing mode");
|
LogWarning("invalid addressing mode");
|
||||||
return (cl_sampler) 0;
|
return (cl_sampler)0;
|
||||||
}
|
}
|
||||||
// Check filter mode
|
// Check filter mode
|
||||||
switch (filterMode) {
|
switch (filterMode) {
|
||||||
case CL_FILTER_NEAREST:
|
case CL_FILTER_NEAREST:
|
||||||
case CL_FILTER_LINEAR:
|
case CL_FILTER_LINEAR:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||||
LogWarning("invalid filter mode");
|
LogWarning("invalid filter mode");
|
||||||
return (cl_sampler) 0;
|
return (cl_sampler)0;
|
||||||
}
|
}
|
||||||
switch (mipFilterMode) {
|
switch (mipFilterMode) {
|
||||||
case CL_FILTER_NONE:
|
case CL_FILTER_NONE:
|
||||||
case CL_FILTER_NEAREST:
|
case CL_FILTER_NEAREST:
|
||||||
case CL_FILTER_LINEAR:
|
case CL_FILTER_LINEAR:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
*not_null(errcode_ret) = CL_INVALID_VALUE;
|
||||||
LogWarning("invalid filter mode");
|
LogWarning("invalid filter mode");
|
||||||
return (cl_sampler) 0;
|
return (cl_sampler)0;
|
||||||
}
|
}
|
||||||
// Create instance of Sampler
|
// Create instance of Sampler
|
||||||
amd::Sampler* sampler = new amd::Sampler(
|
amd::Sampler* sampler =
|
||||||
*as_amd(context),
|
new amd::Sampler(*as_amd(context),
|
||||||
normalizedCoords == CL_TRUE, // To get rid of VS warning C4800
|
normalizedCoords == CL_TRUE, // To get rid of VS warning C4800
|
||||||
addressingMode,
|
addressingMode, filterMode, mipFilterMode, minLod, maxLod);
|
||||||
filterMode,
|
if (!sampler) {
|
||||||
mipFilterMode,
|
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
|
||||||
minLod,
|
LogWarning("not enough host memory");
|
||||||
maxLod);
|
return (cl_sampler)0;
|
||||||
if (!sampler) {
|
}
|
||||||
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
|
|
||||||
LogWarning("not enough host memory");
|
|
||||||
return (cl_sampler) 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sampler->create()) {
|
if (!sampler->create()) {
|
||||||
delete sampler;
|
delete sampler;
|
||||||
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
|
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
|
||||||
LogWarning("Runtime failed sampler creation!");
|
LogWarning("Runtime failed sampler creation!");
|
||||||
return as_cl<amd::Sampler>(0);
|
return as_cl<amd::Sampler>(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
*not_null(errcode_ret) = CL_SUCCESS;
|
*not_null(errcode_ret) = CL_SUCCESS;
|
||||||
return as_cl<amd::Sampler>(sampler);
|
return as_cl<amd::Sampler>(sampler);
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -219,22 +214,17 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY_RET(cl_sampler, clCreateSampler, (
|
RUNTIME_ENTRY_RET(cl_sampler, clCreateSampler, (cl_context context, cl_bool normalized_coords,
|
||||||
cl_context context,
|
cl_addressing_mode addressing_mode,
|
||||||
cl_bool normalized_coords,
|
cl_filter_mode filter_mode, cl_int* errcode_ret)) {
|
||||||
cl_addressing_mode addressing_mode,
|
const cl_sampler_properties sprops[] = {CL_SAMPLER_NORMALIZED_COORDS,
|
||||||
cl_filter_mode filter_mode,
|
static_cast<cl_sampler_properties>(normalized_coords),
|
||||||
cl_int *errcode_ret))
|
CL_SAMPLER_ADDRESSING_MODE,
|
||||||
{
|
static_cast<cl_sampler_properties>(addressing_mode),
|
||||||
const cl_sampler_properties sprops[] = {
|
CL_SAMPLER_FILTER_MODE,
|
||||||
CL_SAMPLER_NORMALIZED_COORDS,
|
static_cast<cl_sampler_properties>(filter_mode),
|
||||||
static_cast<cl_sampler_properties>(normalized_coords),
|
0};
|
||||||
CL_SAMPLER_ADDRESSING_MODE,
|
return clCreateSamplerWithProperties(context, sprops, errcode_ret);
|
||||||
static_cast<cl_sampler_properties>(addressing_mode),
|
|
||||||
CL_SAMPLER_FILTER_MODE,
|
|
||||||
static_cast<cl_sampler_properties>(filter_mode),
|
|
||||||
0 };
|
|
||||||
return clCreateSamplerWithProperties(context, sprops, errcode_ret);
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -247,13 +237,12 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clRetainSampler, (cl_sampler sampler))
|
RUNTIME_ENTRY(cl_int, clRetainSampler, (cl_sampler sampler)) {
|
||||||
{
|
if (!is_valid(sampler)) {
|
||||||
if (!is_valid(sampler)) {
|
return CL_INVALID_SAMPLER;
|
||||||
return CL_INVALID_SAMPLER;
|
}
|
||||||
}
|
as_amd(sampler)->retain();
|
||||||
as_amd(sampler)->retain();
|
return CL_SUCCESS;
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -268,13 +257,12 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clReleaseSampler, (cl_sampler sampler))
|
RUNTIME_ENTRY(cl_int, clReleaseSampler, (cl_sampler sampler)) {
|
||||||
{
|
if (!is_valid(sampler)) {
|
||||||
if (!is_valid(sampler)) {
|
return CL_INVALID_SAMPLER;
|
||||||
return CL_INVALID_SAMPLER;
|
}
|
||||||
}
|
as_amd(sampler)->release();
|
||||||
as_amd(sampler)->release();
|
return CL_SUCCESS;
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -302,64 +290,51 @@ RUNTIME_EXIT
|
|||||||
*
|
*
|
||||||
* \version 1.0r33
|
* \version 1.0r33
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clGetSamplerInfo, (
|
RUNTIME_ENTRY(cl_int, clGetSamplerInfo,
|
||||||
cl_sampler sampler,
|
(cl_sampler sampler, cl_sampler_info param_name, size_t param_value_size,
|
||||||
cl_sampler_info param_name,
|
void* param_value, size_t* param_value_size_ret)) {
|
||||||
size_t param_value_size,
|
if (!is_valid(sampler)) {
|
||||||
void *param_value,
|
return CL_INVALID_SAMPLER;
|
||||||
size_t *param_value_size_ret))
|
}
|
||||||
{
|
|
||||||
if (!is_valid(sampler)) {
|
|
||||||
return CL_INVALID_SAMPLER;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (param_name)
|
switch (param_name) {
|
||||||
{
|
|
||||||
case CL_SAMPLER_REFERENCE_COUNT: {
|
case CL_SAMPLER_REFERENCE_COUNT: {
|
||||||
cl_uint count = as_amd(sampler)->referenceCount();
|
cl_uint count = as_amd(sampler)->referenceCount();
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(count, param_value_size, param_value, param_value_size_ret);
|
||||||
count, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
case CL_SAMPLER_CONTEXT: {
|
case CL_SAMPLER_CONTEXT: {
|
||||||
cl_context context = as_cl(&as_amd(sampler)->context());
|
cl_context context = as_cl(&as_amd(sampler)->context());
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(context, param_value_size, param_value, param_value_size_ret);
|
||||||
context, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
case CL_SAMPLER_ADDRESSING_MODE: {
|
case CL_SAMPLER_ADDRESSING_MODE: {
|
||||||
cl_addressing_mode addressing = as_amd(sampler)->addressingMode();
|
cl_addressing_mode addressing = as_amd(sampler)->addressingMode();
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(addressing, param_value_size, param_value, param_value_size_ret);
|
||||||
addressing, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
case CL_SAMPLER_FILTER_MODE: {
|
case CL_SAMPLER_FILTER_MODE: {
|
||||||
cl_filter_mode filter = as_amd(sampler)->filterMode();
|
cl_filter_mode filter = as_amd(sampler)->filterMode();
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(filter, param_value_size, param_value, param_value_size_ret);
|
||||||
filter, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
case CL_SAMPLER_NORMALIZED_COORDS: {
|
case CL_SAMPLER_NORMALIZED_COORDS: {
|
||||||
cl_bool normalized = as_amd(sampler)->normalizedCoords();
|
cl_bool normalized = as_amd(sampler)->normalizedCoords();
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(normalized, param_value_size, param_value, param_value_size_ret);
|
||||||
normalized, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
case CL_SAMPLER_MIP_FILTER_MODE: {
|
case CL_SAMPLER_MIP_FILTER_MODE: {
|
||||||
cl_filter_mode mipFilter = as_amd(sampler)->mipFilter();
|
cl_filter_mode mipFilter = as_amd(sampler)->mipFilter();
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(mipFilter, param_value_size, param_value, param_value_size_ret);
|
||||||
mipFilter, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
case CL_SAMPLER_LOD_MIN: {
|
case CL_SAMPLER_LOD_MIN: {
|
||||||
cl_float minLod = as_amd(sampler)->minLod();
|
cl_float minLod = as_amd(sampler)->minLod();
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(minLod, param_value_size, param_value, param_value_size_ret);
|
||||||
minLod, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
case CL_SAMPLER_LOD_MAX: {
|
case CL_SAMPLER_LOD_MAX: {
|
||||||
cl_float maxLod = as_amd(sampler)->maxLod();
|
cl_float maxLod = as_amd(sampler)->maxLod();
|
||||||
return amd::clGetInfo(
|
return amd::clGetInfo(maxLod, param_value_size, param_value, param_value_size_ret);
|
||||||
maxLod, param_value_size, param_value, param_value_size_ret);
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
|
|||||||
@@ -6,254 +6,216 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
|
||||||
RUNTIME_ENTRY(cl_int, clEnqueueWaitSignalAMD, (
|
RUNTIME_ENTRY(cl_int, clEnqueueWaitSignalAMD,
|
||||||
cl_command_queue command_queue,
|
(cl_command_queue command_queue, cl_mem mem_object, cl_uint value, cl_uint num_events,
|
||||||
cl_mem mem_object,
|
const cl_event* event_wait_list, cl_event* event)) {
|
||||||
cl_uint value,
|
if (!is_valid(command_queue)) {
|
||||||
cl_uint num_events,
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
const cl_event * event_wait_list,
|
}
|
||||||
cl_event * event) )
|
|
||||||
|
if (!is_valid(mem_object)) {
|
||||||
|
return CL_INVALID_MEM_OBJECT;
|
||||||
|
}
|
||||||
|
|
||||||
|
amd::Buffer* buffer = as_amd(mem_object)->asBuffer();
|
||||||
|
if (buffer == NULL) {
|
||||||
|
return CL_INVALID_MEM_OBJECT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(buffer->getMemFlags() & CL_MEM_BUS_ADDRESSABLE_AMD)) {
|
||||||
|
return CL_INVALID_MEM_OBJECT;
|
||||||
|
}
|
||||||
|
|
||||||
|
amd::HostQueue* queue = as_amd(command_queue)->asHostQueue();
|
||||||
|
if (NULL == queue) {
|
||||||
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
|
}
|
||||||
|
amd::HostQueue& hostQueue = *queue;
|
||||||
|
|
||||||
|
if (hostQueue.context() != buffer->getContext()) {
|
||||||
|
return CL_INVALID_CONTEXT;
|
||||||
|
}
|
||||||
|
|
||||||
|
amd::Command::EventWaitList eventWaitList;
|
||||||
|
cl_int err =
|
||||||
|
amd::clSetEventWaitList(eventWaitList, hostQueue.context(), num_events, event_wait_list);
|
||||||
|
|
||||||
|
if (err != CL_SUCCESS) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
amd::SignalCommand* command =
|
||||||
|
new amd::SignalCommand(hostQueue, CL_COMMAND_WAIT_SIGNAL_AMD, eventWaitList, *buffer, value);
|
||||||
|
|
||||||
|
if (command == NULL) {
|
||||||
|
return CL_OUT_OF_HOST_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure we have memory for the command execution
|
||||||
|
if (!command->validateMemory()) {
|
||||||
|
delete command;
|
||||||
|
return CL_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
command->enqueue();
|
||||||
|
|
||||||
|
*not_null(event) = as_cl(&command->event());
|
||||||
|
if (event == NULL) {
|
||||||
|
command->release();
|
||||||
|
}
|
||||||
|
|
||||||
|
return CL_SUCCESS;
|
||||||
|
}
|
||||||
|
RUNTIME_EXIT
|
||||||
|
|
||||||
|
|
||||||
|
RUNTIME_ENTRY(cl_int, clEnqueueWriteSignalAMD,
|
||||||
|
(cl_command_queue command_queue, cl_mem mem_object, cl_uint value, cl_ulong offset,
|
||||||
|
cl_uint num_events, const cl_event* event_wait_list, cl_event* event))
|
||||||
|
|
||||||
{
|
{
|
||||||
if (!is_valid(command_queue)) {
|
if (!is_valid(command_queue)) {
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_valid(mem_object)) {
|
||||||
|
return CL_INVALID_MEM_OBJECT;
|
||||||
|
}
|
||||||
|
|
||||||
|
amd::Buffer* buffer = as_amd(mem_object)->asBuffer();
|
||||||
|
if (buffer == NULL) {
|
||||||
|
return CL_INVALID_MEM_OBJECT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(buffer->getMemFlags() & CL_MEM_EXTERNAL_PHYSICAL_AMD)) {
|
||||||
|
return CL_INVALID_MEM_OBJECT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((offset + sizeof(value)) > (buffer->getSize() + amd::Os::pageSize())) {
|
||||||
|
return CL_INVALID_BUFFER_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
amd::HostQueue* queue = as_amd(command_queue)->asHostQueue();
|
||||||
|
if (NULL == queue) {
|
||||||
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
|
}
|
||||||
|
amd::HostQueue& hostQueue = *queue;
|
||||||
|
|
||||||
|
if (hostQueue.context() != buffer->getContext()) {
|
||||||
|
return CL_INVALID_CONTEXT;
|
||||||
|
}
|
||||||
|
|
||||||
|
amd::Command::EventWaitList eventWaitList;
|
||||||
|
cl_int err =
|
||||||
|
amd::clSetEventWaitList(eventWaitList, hostQueue.context(), num_events, event_wait_list);
|
||||||
|
|
||||||
|
if (err != CL_SUCCESS) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
amd::SignalCommand* command = new amd::SignalCommand(hostQueue, CL_COMMAND_WRITE_SIGNAL_AMD,
|
||||||
|
eventWaitList, *buffer, value, offset);
|
||||||
|
|
||||||
|
if (command == NULL) {
|
||||||
|
return CL_OUT_OF_HOST_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure we have memory for the command execution
|
||||||
|
if (!command->validateMemory()) {
|
||||||
|
delete command;
|
||||||
|
return CL_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
command->enqueue();
|
||||||
|
|
||||||
|
*not_null(event) = as_cl(&command->event());
|
||||||
|
if (event == NULL) {
|
||||||
|
command->release();
|
||||||
|
}
|
||||||
|
|
||||||
|
return CL_SUCCESS;
|
||||||
|
}
|
||||||
|
RUNTIME_EXIT
|
||||||
|
|
||||||
|
|
||||||
|
RUNTIME_ENTRY(cl_int, clEnqueueMakeBuffersResidentAMD,
|
||||||
|
(cl_command_queue command_queue, cl_uint num_mem_objs, cl_mem* mem_objects,
|
||||||
|
cl_bool blocking_make_resident, cl_bus_address_amd* bus_addresses,
|
||||||
|
cl_uint num_events, const cl_event* event_wait_list, cl_event* event)) {
|
||||||
|
if (!is_valid(command_queue)) {
|
||||||
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mem_objects == 0) {
|
||||||
|
return CL_INVALID_MEM_OBJECT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bus_addresses == 0 || num_mem_objs == 0) {
|
||||||
|
return CL_INVALID_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(bus_addresses, 0, sizeof(cl_bus_address_amd) * num_mem_objs);
|
||||||
|
|
||||||
|
amd::HostQueue* queue = as_amd(command_queue)->asHostQueue();
|
||||||
|
if (NULL == queue) {
|
||||||
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
|
}
|
||||||
|
amd::HostQueue& hostQueue = *queue;
|
||||||
|
|
||||||
|
std::vector<amd::Memory*> memObjects;
|
||||||
|
for (unsigned int i = 0; i < num_mem_objs; ++i) {
|
||||||
|
if (!is_valid(mem_objects[i])) {
|
||||||
|
return CL_INVALID_MEM_OBJECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_valid(mem_object)) {
|
amd::Buffer* buffer = as_amd(mem_objects[i])->asBuffer();
|
||||||
return CL_INVALID_MEM_OBJECT;
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::Buffer* buffer = as_amd(mem_object)->asBuffer();
|
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
return CL_INVALID_MEM_OBJECT;
|
return CL_INVALID_MEM_OBJECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(buffer->getMemFlags() & CL_MEM_BUS_ADDRESSABLE_AMD)) {
|
if (!(buffer->getMemFlags() & CL_MEM_BUS_ADDRESSABLE_AMD)) {
|
||||||
return CL_INVALID_MEM_OBJECT;
|
return CL_INVALID_MEM_OBJECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
amd::HostQueue* queue = as_amd(command_queue)->asHostQueue();
|
|
||||||
if (NULL == queue) {
|
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
|
||||||
}
|
|
||||||
amd::HostQueue& hostQueue = *queue;
|
|
||||||
|
|
||||||
if (hostQueue.context() != buffer->getContext()) {
|
if (hostQueue.context() != buffer->getContext()) {
|
||||||
return CL_INVALID_CONTEXT;
|
return CL_INVALID_CONTEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
amd::Command::EventWaitList eventWaitList;
|
memObjects.push_back(buffer);
|
||||||
cl_int err = amd::clSetEventWaitList( eventWaitList,
|
}
|
||||||
hostQueue.context(),
|
|
||||||
num_events,
|
|
||||||
event_wait_list);
|
|
||||||
|
|
||||||
if (err != CL_SUCCESS) {
|
amd::Command::EventWaitList eventWaitList;
|
||||||
return err;
|
cl_int err =
|
||||||
}
|
amd::clSetEventWaitList(eventWaitList, hostQueue.context(), num_events, event_wait_list);
|
||||||
|
|
||||||
amd::SignalCommand * command = new amd::SignalCommand (
|
if (err != CL_SUCCESS) {
|
||||||
hostQueue,
|
return err;
|
||||||
CL_COMMAND_WAIT_SIGNAL_AMD,
|
}
|
||||||
eventWaitList,
|
|
||||||
*buffer,
|
|
||||||
value);
|
|
||||||
|
|
||||||
if (command == NULL) {
|
amd::MakeBuffersResidentCommand* command = new amd::MakeBuffersResidentCommand(
|
||||||
return CL_OUT_OF_HOST_MEMORY;
|
hostQueue, CL_COMMAND_MAKE_BUFFERS_RESIDENT_AMD, eventWaitList, memObjects, bus_addresses);
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure we have memory for the command execution
|
if (command == NULL) {
|
||||||
if (!command->validateMemory()) {
|
return CL_OUT_OF_HOST_MEMORY;
|
||||||
delete command;
|
}
|
||||||
return CL_OUT_OF_RESOURCES;
|
|
||||||
}
|
|
||||||
|
|
||||||
command->enqueue();
|
// Make sure we have memory for the command execution
|
||||||
|
if (!command->validateMemory()) {
|
||||||
|
delete command;
|
||||||
|
return CL_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
*not_null(event) = as_cl(&command->event());
|
command->enqueue();
|
||||||
if (event == NULL) {
|
|
||||||
command->release();
|
|
||||||
}
|
|
||||||
|
|
||||||
return CL_SUCCESS;
|
if (blocking_make_resident) {
|
||||||
|
command->awaitCompletion();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
*not_null(event) = as_cl(&command->event());
|
||||||
RUNTIME_EXIT
|
if (event == NULL) {
|
||||||
|
command->release();
|
||||||
|
}
|
||||||
|
|
||||||
|
return CL_SUCCESS;
|
||||||
RUNTIME_ENTRY(cl_int, clEnqueueWriteSignalAMD, (
|
|
||||||
cl_command_queue command_queue,
|
|
||||||
cl_mem mem_object,
|
|
||||||
cl_uint value,
|
|
||||||
cl_ulong offset,
|
|
||||||
cl_uint num_events,
|
|
||||||
const cl_event * event_wait_list,
|
|
||||||
cl_event * event))
|
|
||||||
|
|
||||||
{
|
|
||||||
if (!is_valid(command_queue)) {
|
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_valid(mem_object)) {
|
|
||||||
return CL_INVALID_MEM_OBJECT;
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::Buffer* buffer = as_amd(mem_object)->asBuffer();
|
|
||||||
if (buffer == NULL) {
|
|
||||||
return CL_INVALID_MEM_OBJECT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(buffer->getMemFlags() & CL_MEM_EXTERNAL_PHYSICAL_AMD)) {
|
|
||||||
return CL_INVALID_MEM_OBJECT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((offset + sizeof(value)) > (buffer->getSize()+ amd::Os::pageSize())) {
|
|
||||||
return CL_INVALID_BUFFER_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::HostQueue* queue = as_amd(command_queue)->asHostQueue();
|
|
||||||
if (NULL == queue) {
|
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
|
||||||
}
|
|
||||||
amd::HostQueue& hostQueue = *queue;
|
|
||||||
|
|
||||||
if (hostQueue.context() != buffer->getContext()) {
|
|
||||||
return CL_INVALID_CONTEXT;
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::Command::EventWaitList eventWaitList;
|
|
||||||
cl_int err = amd::clSetEventWaitList( eventWaitList,
|
|
||||||
hostQueue.context(),
|
|
||||||
num_events,
|
|
||||||
event_wait_list);
|
|
||||||
|
|
||||||
if (err != CL_SUCCESS) {
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::SignalCommand * command = new amd::SignalCommand (
|
|
||||||
hostQueue,
|
|
||||||
CL_COMMAND_WRITE_SIGNAL_AMD,
|
|
||||||
eventWaitList,
|
|
||||||
*buffer,
|
|
||||||
value,
|
|
||||||
offset);
|
|
||||||
|
|
||||||
if (command == NULL) {
|
|
||||||
return CL_OUT_OF_HOST_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure we have memory for the command execution
|
|
||||||
if (!command->validateMemory()) {
|
|
||||||
delete command;
|
|
||||||
return CL_OUT_OF_RESOURCES;
|
|
||||||
}
|
|
||||||
|
|
||||||
command->enqueue();
|
|
||||||
|
|
||||||
*not_null(event) = as_cl(&command->event());
|
|
||||||
if (event == NULL) {
|
|
||||||
command->release();
|
|
||||||
}
|
|
||||||
|
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
|
||||||
RUNTIME_EXIT
|
|
||||||
|
|
||||||
|
|
||||||
RUNTIME_ENTRY(cl_int, clEnqueueMakeBuffersResidentAMD, (
|
|
||||||
cl_command_queue command_queue,
|
|
||||||
cl_uint num_mem_objs,
|
|
||||||
cl_mem * mem_objects,
|
|
||||||
cl_bool blocking_make_resident,
|
|
||||||
cl_bus_address_amd * bus_addresses,
|
|
||||||
cl_uint num_events,
|
|
||||||
const cl_event * event_wait_list,
|
|
||||||
cl_event * event))
|
|
||||||
{
|
|
||||||
if (!is_valid(command_queue)) {
|
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mem_objects == 0) {
|
|
||||||
return CL_INVALID_MEM_OBJECT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bus_addresses == 0 || num_mem_objs == 0) {
|
|
||||||
return CL_INVALID_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(bus_addresses,0, sizeof(cl_bus_address_amd)*num_mem_objs);
|
|
||||||
|
|
||||||
amd::HostQueue* queue = as_amd(command_queue)->asHostQueue();
|
|
||||||
if (NULL == queue) {
|
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
|
||||||
}
|
|
||||||
amd::HostQueue& hostQueue = *queue;
|
|
||||||
|
|
||||||
std::vector<amd::Memory*> memObjects;
|
|
||||||
for (unsigned int i = 0; i < num_mem_objs; ++i) {
|
|
||||||
|
|
||||||
if (!is_valid(mem_objects[i])) {
|
|
||||||
return CL_INVALID_MEM_OBJECT;
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::Buffer* buffer = as_amd(mem_objects[i])->asBuffer();
|
|
||||||
if (buffer == NULL) {
|
|
||||||
return CL_INVALID_MEM_OBJECT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(buffer->getMemFlags() & CL_MEM_BUS_ADDRESSABLE_AMD)) {
|
|
||||||
return CL_INVALID_MEM_OBJECT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hostQueue.context() != buffer->getContext()) {
|
|
||||||
return CL_INVALID_CONTEXT;
|
|
||||||
}
|
|
||||||
|
|
||||||
memObjects.push_back(buffer);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::Command::EventWaitList eventWaitList;
|
|
||||||
cl_int err = amd::clSetEventWaitList( eventWaitList,
|
|
||||||
hostQueue.context(),
|
|
||||||
num_events,
|
|
||||||
event_wait_list);
|
|
||||||
|
|
||||||
if (err != CL_SUCCESS) {
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::MakeBuffersResidentCommand * command =
|
|
||||||
new amd::MakeBuffersResidentCommand ( hostQueue,
|
|
||||||
CL_COMMAND_MAKE_BUFFERS_RESIDENT_AMD,
|
|
||||||
eventWaitList,
|
|
||||||
memObjects,
|
|
||||||
bus_addresses);
|
|
||||||
|
|
||||||
if (command == NULL) {
|
|
||||||
return CL_OUT_OF_HOST_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure we have memory for the command execution
|
|
||||||
if (!command->validateMemory()) {
|
|
||||||
delete command;
|
|
||||||
return CL_OUT_OF_RESOURCES;
|
|
||||||
}
|
|
||||||
|
|
||||||
command->enqueue();
|
|
||||||
|
|
||||||
if (blocking_make_resident) {
|
|
||||||
command->awaitCompletion();
|
|
||||||
}
|
|
||||||
|
|
||||||
*not_null(event) = as_cl(&command->event());
|
|
||||||
if (event == NULL) {
|
|
||||||
command->release();
|
|
||||||
}
|
|
||||||
|
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
@@ -8,37 +8,20 @@ extern "C" {
|
|||||||
#endif /*__cplusplus*/
|
#endif /*__cplusplus*/
|
||||||
|
|
||||||
|
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueWaitSignalAMD(
|
||||||
clEnqueueWaitSignalAMD(
|
cl_command_queue command_queue, cl_mem mem_object, cl_uint value, cl_uint num_events,
|
||||||
cl_command_queue command_queue,
|
const cl_event* event_wait_list, cl_event* event) CL_EXT_SUFFIX__VERSION_1_2;
|
||||||
cl_mem mem_object,
|
|
||||||
cl_uint value,
|
|
||||||
cl_uint num_events,
|
|
||||||
const cl_event * event_wait_list,
|
|
||||||
cl_event * event) CL_EXT_SUFFIX__VERSION_1_2;
|
|
||||||
|
|
||||||
|
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueWriteSignalAMD(
|
||||||
clEnqueueWriteSignalAMD(
|
cl_command_queue command_queue, cl_mem mem_object, cl_uint value, cl_ulong offset,
|
||||||
cl_command_queue command_queue,
|
cl_uint num_events, const cl_event* event_list, cl_event* event) CL_EXT_SUFFIX__VERSION_1_2;
|
||||||
cl_mem mem_object,
|
|
||||||
cl_uint value,
|
|
||||||
cl_ulong offset,
|
|
||||||
cl_uint num_events,
|
|
||||||
const cl_event * event_list,
|
|
||||||
cl_event * event) CL_EXT_SUFFIX__VERSION_1_2;
|
|
||||||
|
|
||||||
|
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueMakeBuffersResidentAMD(
|
||||||
clEnqueueMakeBuffersResidentAMD(
|
cl_command_queue command_queue, cl_uint num_mem_objs, cl_mem* mem_objects,
|
||||||
cl_command_queue command_queue,
|
cl_bool blocking_make_resident, cl_bus_address_amd* bus_addresses, cl_uint num_events,
|
||||||
cl_uint num_mem_objs,
|
const cl_event* event_list, cl_event* event) CL_EXT_SUFFIX__VERSION_1_2;
|
||||||
cl_mem * mem_objects,
|
|
||||||
cl_bool blocking_make_resident,
|
|
||||||
cl_bus_address_amd * bus_addresses,
|
|
||||||
cl_uint num_events,
|
|
||||||
const cl_event * event_list,
|
|
||||||
cl_event * event) CL_EXT_SUFFIX__VERSION_1_2;
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -102,12 +102,12 @@ jurisdiction and venue of these courts.
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
/* cl_device_info */
|
/* cl_device_info */
|
||||||
#define CL_DEVICE_MAX_SEMAPHORES_AMD 0xF050
|
#define CL_DEVICE_MAX_SEMAPHORES_AMD 0xF050
|
||||||
#define CL_DEVICE_MAX_SEMAPHORE_SIZE_AMD 0xF051
|
#define CL_DEVICE_MAX_SEMAPHORE_SIZE_AMD 0xF051
|
||||||
|
|
||||||
/* cl_kernel_work_group_info */
|
/* cl_kernel_work_group_info */
|
||||||
#define CL_KERNEL_MAX_SEMAPHORE_SIZE_AMD 0xF052
|
#define CL_KERNEL_MAX_SEMAPHORE_SIZE_AMD 0xF052
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
+465
-542
File diff suppressed because it is too large
Load Diff
@@ -31,27 +31,24 @@
|
|||||||
*
|
*
|
||||||
* \return Created cl_threadtrace_amd object
|
* \return Created cl_threadtrace_amd object
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY_RET(cl_threadtrace_amd, clCreateThreadTraceAMD, (
|
RUNTIME_ENTRY_RET(cl_threadtrace_amd, clCreateThreadTraceAMD,
|
||||||
cl_device_id device,
|
(cl_device_id device, cl_int* errcode_ret)) {
|
||||||
cl_int* errcode_ret))
|
// Make sure we have a valid device object
|
||||||
{
|
if (!is_valid(device)) {
|
||||||
// Make sure we have a valid device object
|
*not_null(errcode_ret) = CL_INVALID_DEVICE;
|
||||||
if (!is_valid(device)) {
|
return NULL;
|
||||||
*not_null(errcode_ret) = CL_INVALID_DEVICE;
|
}
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the device thread trace object
|
// Create the device thread trace object
|
||||||
amd::ThreadTrace* threadTrace =
|
amd::ThreadTrace* threadTrace = new amd::ThreadTrace(*as_amd(device));
|
||||||
new amd::ThreadTrace(*as_amd(device));
|
|
||||||
|
|
||||||
if (threadTrace == NULL) {
|
if (threadTrace == NULL) {
|
||||||
*not_null(errcode_ret) = CL_INVALID_OPERATION;
|
*not_null(errcode_ret) = CL_INVALID_OPERATION;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
*not_null(errcode_ret) = CL_SUCCESS;
|
*not_null(errcode_ret) = CL_SUCCESS;
|
||||||
return as_cl(threadTrace);
|
return as_cl(threadTrace);
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -63,14 +60,12 @@ RUNTIME_EXIT
|
|||||||
// * - CL_SUCCESS if the function is executed successfully.
|
// * - CL_SUCCESS if the function is executed successfully.
|
||||||
// * - CL_INVALID_OPERATION if we failed to release the object
|
// * - CL_INVALID_OPERATION if we failed to release the object
|
||||||
// */
|
// */
|
||||||
RUNTIME_ENTRY(cl_int, clReleaseThreadTraceAMD, (
|
RUNTIME_ENTRY(cl_int, clReleaseThreadTraceAMD, (cl_threadtrace_amd threadTrace)) {
|
||||||
cl_threadtrace_amd threadTrace))
|
if (!is_valid(threadTrace)) {
|
||||||
{
|
return CL_INVALID_OPERATION;
|
||||||
if (!is_valid(threadTrace)) {
|
}
|
||||||
return CL_INVALID_OPERATION;
|
as_amd(threadTrace)->release();
|
||||||
}
|
return CL_SUCCESS;
|
||||||
as_amd(threadTrace)->release();
|
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
//
|
//
|
||||||
@@ -82,14 +77,12 @@ RUNTIME_EXIT
|
|||||||
// * - CL_SUCCESS if the function is executed successfully.
|
// * - CL_SUCCESS if the function is executed successfully.
|
||||||
// * - CL_INVALID_OPERATION if we failed to release the object
|
// * - CL_INVALID_OPERATION if we failed to release the object
|
||||||
// */
|
// */
|
||||||
RUNTIME_ENTRY(cl_int, clRetainThreadTraceAMD, (
|
RUNTIME_ENTRY(cl_int, clRetainThreadTraceAMD, (cl_threadtrace_amd threadTrace)) {
|
||||||
cl_threadtrace_amd threadTrace))
|
if (!is_valid(threadTrace)) {
|
||||||
{
|
return CL_INVALID_OPERATION;
|
||||||
if (!is_valid(threadTrace)) {
|
}
|
||||||
return CL_INVALID_OPERATION;
|
as_amd(threadTrace)->retain();
|
||||||
}
|
return CL_SUCCESS;
|
||||||
as_amd(threadTrace)->retain();
|
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -105,70 +98,71 @@ RUNTIME_EXIT
|
|||||||
// * \return A non zero value if OpenCL failed to set threadTrace buffer parameter
|
// * \return A non zero value if OpenCL failed to set threadTrace buffer parameter
|
||||||
// * - CL_INVALID_VALUE if the thread_trace is invalid thread trace object.
|
// * - CL_INVALID_VALUE if the thread_trace is invalid thread trace object.
|
||||||
// * - CL_INVALID_VALUE if the invalid config_param or param_value enum values , are used.
|
// * - CL_INVALID_VALUE if the invalid config_param or param_value enum values , are used.
|
||||||
// * - CL_INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or event_wait_list is not NULL and num_events_in_wait_list is 0,
|
// * - CL_INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or
|
||||||
|
// event_wait_list is not NULL and num_events_in_wait_list is 0,
|
||||||
// * - or if event objects in event_wait_list are not valid events.
|
// * - or if event objects in event_wait_list are not valid events.
|
||||||
// * - CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.
|
// * - CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL
|
||||||
|
// implementation on the device.
|
||||||
// * - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the
|
// * - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the
|
||||||
// OpenCL implementation on the host.
|
// OpenCL implementation on the host.
|
||||||
// */
|
// */
|
||||||
RUNTIME_ENTRY(cl_int, clSetThreadTraceParamAMD,(cl_threadtrace_amd thread_trace ,
|
RUNTIME_ENTRY(cl_int, clSetThreadTraceParamAMD,
|
||||||
cl_thread_trace_param config_param ,
|
(cl_threadtrace_amd thread_trace, cl_thread_trace_param config_param,
|
||||||
cl_uint param_value ))
|
cl_uint param_value)) {
|
||||||
{
|
if (!is_valid(thread_trace)) {
|
||||||
if (!is_valid(thread_trace)) {
|
return CL_INVALID_OPERATION;
|
||||||
return CL_INVALID_OPERATION;
|
}
|
||||||
}
|
switch (config_param) {
|
||||||
switch (config_param) {
|
|
||||||
case CL_THREAD_TRACE_PARAM_TOKEN_MASK:
|
case CL_THREAD_TRACE_PARAM_TOKEN_MASK:
|
||||||
if (param_value > CL_THREAD_TRACE_TOKEN_MASK_ALL_SI) {
|
if (param_value > CL_THREAD_TRACE_TOKEN_MASK_ALL_SI) {
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
as_amd(thread_trace)->setTokenMask(param_value);
|
as_amd(thread_trace)->setTokenMask(param_value);
|
||||||
break;
|
break;
|
||||||
case CL_THREAD_TRACE_PARAM_REG_MASK:
|
case CL_THREAD_TRACE_PARAM_REG_MASK:
|
||||||
if (param_value > CL_THREAD_TRACE_REG_MASK_ALL_SI) {
|
if (param_value > CL_THREAD_TRACE_REG_MASK_ALL_SI) {
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
as_amd(thread_trace)->setRegMask(param_value);
|
as_amd(thread_trace)->setRegMask(param_value);
|
||||||
break;
|
break;
|
||||||
case CL_THREAD_TRACE_PARAM_VM_ID_MASK:
|
case CL_THREAD_TRACE_PARAM_VM_ID_MASK:
|
||||||
if (param_value > CL_THREAD_TRACE_VM_ID_MASK_SINGLE_DETAIL) {
|
if (param_value > CL_THREAD_TRACE_VM_ID_MASK_SINGLE_DETAIL) {
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
as_amd(thread_trace)->setVmIdMask(param_value);
|
as_amd(thread_trace)->setVmIdMask(param_value);
|
||||||
break;
|
break;
|
||||||
case CL_THREAD_TRACE_PARAM_INSTRUCTION_MASK:
|
case CL_THREAD_TRACE_PARAM_INSTRUCTION_MASK:
|
||||||
if (param_value > CL_THREAD_TRACE_INST_MASK_IMMEDIATE_CI) {
|
if (param_value > CL_THREAD_TRACE_INST_MASK_IMMEDIATE_CI) {
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
as_amd(thread_trace)->setInstMask(param_value);
|
as_amd(thread_trace)->setInstMask(param_value);
|
||||||
break;
|
break;
|
||||||
case CL_THREAD_TRACE_PARAM_COMPUTE_UNIT_TARGET:
|
case CL_THREAD_TRACE_PARAM_COMPUTE_UNIT_TARGET:
|
||||||
as_amd(thread_trace)->setCU(param_value);
|
as_amd(thread_trace)->setCU(param_value);
|
||||||
break;
|
break;
|
||||||
case CL_THREAD_TRACE_PARAM_SHADER_ARRAY_TARGET:
|
case CL_THREAD_TRACE_PARAM_SHADER_ARRAY_TARGET:
|
||||||
as_amd(thread_trace)->setSH(param_value);
|
as_amd(thread_trace)->setSH(param_value);
|
||||||
break;
|
break;
|
||||||
case CL_THREAD_TRACE_PARAM_SIMD_MASK:
|
case CL_THREAD_TRACE_PARAM_SIMD_MASK:
|
||||||
as_amd(thread_trace)->setSIMD(param_value);
|
as_amd(thread_trace)->setSIMD(param_value);
|
||||||
break;
|
break;
|
||||||
case CL_THREAD_TRACE_PARAM_USER_DATA:
|
case CL_THREAD_TRACE_PARAM_USER_DATA:
|
||||||
as_amd(thread_trace)->setUserData(param_value);
|
as_amd(thread_trace)->setUserData(param_value);
|
||||||
break;
|
break;
|
||||||
case CL_THREAD_TRACE_PARAM_CAPTURE_MODE:
|
case CL_THREAD_TRACE_PARAM_CAPTURE_MODE:
|
||||||
if (param_value > CL_THREAD_TRACE_CAPTURE_SELECT_DETAIL) {
|
if (param_value > CL_THREAD_TRACE_CAPTURE_SELECT_DETAIL) {
|
||||||
return CL_INVALID_VALUE;
|
return CL_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
as_amd(thread_trace)->setCaptureMode(param_value);
|
as_amd(thread_trace)->setCaptureMode(param_value);
|
||||||
break;
|
break;
|
||||||
case CL_THREAD_TRACE_PARAM_IS_WRAPPED:
|
case CL_THREAD_TRACE_PARAM_IS_WRAPPED:
|
||||||
as_amd(thread_trace)->setIsWrapped(true);
|
as_amd(thread_trace)->setIsWrapped(true);
|
||||||
break;
|
break;
|
||||||
case CL_THREAD_TRACE_PARAM_RANDOM_SEED:
|
case CL_THREAD_TRACE_PARAM_RANDOM_SEED:
|
||||||
as_amd(thread_trace)->setRandomSeed(param_value);
|
as_amd(thread_trace)->setRandomSeed(param_value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -195,66 +189,59 @@ RUNTIME_EXIT
|
|||||||
* - CL_SUCCESS if the function is executed successfully.
|
* - CL_SUCCESS if the function is executed successfully.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
RUNTIME_ENTRY(cl_int, clGetThreadTraceInfoAMD, (
|
RUNTIME_ENTRY(cl_int, clGetThreadTraceInfoAMD,
|
||||||
cl_threadtrace_amd thread_trace /* threadTrace */,
|
(cl_threadtrace_amd thread_trace /* threadTrace */,
|
||||||
cl_threadtrace_info thread_trace_info_param,
|
cl_threadtrace_info thread_trace_info_param, size_t param_value_size,
|
||||||
size_t param_value_size,
|
void* param_value, size_t* param_value_size_ret)) {
|
||||||
void* param_value,
|
if (!is_valid(thread_trace)) {
|
||||||
size_t* param_value_size_ret))
|
return CL_INVALID_OPERATION;
|
||||||
{
|
}
|
||||||
if (!is_valid(thread_trace)) {
|
|
||||||
|
// Find the thread trace object, associated with the specified device
|
||||||
|
const device::ThreadTrace* devThreadTrace = as_amd(thread_trace)->getDeviceThreadTrace();
|
||||||
|
|
||||||
|
const size_t seNum = as_amd(thread_trace)->deviceSeNumThreadTrace();
|
||||||
|
switch (thread_trace_info_param) {
|
||||||
|
case CL_THREAD_TRACE_SE: {
|
||||||
|
return amd::clGetInfo(seNum, param_value_size, param_value, param_value_size_ret);
|
||||||
|
}
|
||||||
|
case CL_THREAD_TRACE_BUFFERS_SIZE: {
|
||||||
|
// Make sure we found a valid thread trace object
|
||||||
|
if (devThreadTrace == NULL) {
|
||||||
return CL_INVALID_OPERATION;
|
return CL_INVALID_OPERATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the thread trace object, associated with the specified device
|
std::unique_ptr<uint> bufSize2Se(new uint[seNum]);
|
||||||
const device::ThreadTrace* devThreadTrace =
|
|
||||||
as_amd(thread_trace)->getDeviceThreadTrace();
|
|
||||||
|
|
||||||
const size_t seNum = as_amd(thread_trace)->deviceSeNumThreadTrace();
|
if (bufSize2Se.get() == NULL) {
|
||||||
switch (thread_trace_info_param) {
|
return CL_OUT_OF_HOST_MEMORY;
|
||||||
case CL_THREAD_TRACE_SE:
|
}
|
||||||
{
|
|
||||||
return amd::clGetInfo(seNum,
|
if (!devThreadTrace->info(thread_trace_info_param, bufSize2Se.get(), seNum)) {
|
||||||
param_value_size, param_value, param_value_size_ret);
|
return CL_INVALID_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
const size_t valueSize = seNum * sizeof(unsigned int);
|
||||||
|
|
||||||
|
if (param_value != NULL && param_value_size < valueSize) {
|
||||||
|
return CL_INVALID_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*not_null(param_value_size_ret) = valueSize;
|
||||||
|
|
||||||
|
if (param_value != NULL) {
|
||||||
|
::memcpy(param_value, bufSize2Se.get(), valueSize);
|
||||||
|
if (param_value_size > valueSize) {
|
||||||
|
::memset(static_cast<address>(param_value) + valueSize, '\0',
|
||||||
|
param_value_size - valueSize);
|
||||||
}
|
}
|
||||||
case CL_THREAD_TRACE_BUFFERS_SIZE:
|
}
|
||||||
{
|
|
||||||
// Make sure we found a valid thread trace object
|
|
||||||
if (devThreadTrace == NULL) {
|
|
||||||
return CL_INVALID_OPERATION;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<uint> bufSize2Se(new uint[seNum]);
|
return CL_SUCCESS;
|
||||||
|
|
||||||
if (bufSize2Se.get() == NULL) {
|
|
||||||
return CL_OUT_OF_HOST_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!devThreadTrace->info(thread_trace_info_param, bufSize2Se.get(), seNum)) {
|
|
||||||
return CL_INVALID_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
const size_t valueSize = seNum * sizeof(unsigned int);
|
|
||||||
|
|
||||||
if (param_value != NULL && param_value_size < valueSize) {
|
|
||||||
return CL_INVALID_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
*not_null(param_value_size_ret) = valueSize;
|
|
||||||
|
|
||||||
if (param_value != NULL) {
|
|
||||||
::memcpy(param_value, bufSize2Se.get(), valueSize);
|
|
||||||
if (param_value_size > valueSize) {
|
|
||||||
::memset(static_cast<address>(param_value) + valueSize,
|
|
||||||
'\0', param_value_size - valueSize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
@@ -284,112 +271,122 @@ RUNTIME_EXIT
|
|||||||
* wait for this command to complete.
|
* wait for this command to complete.
|
||||||
* \return A non zero value if OpenCL failed to release threadTrace
|
* \return A non zero value if OpenCL failed to release threadTrace
|
||||||
* - CL_INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue.
|
* - CL_INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue.
|
||||||
* - CL_INVALID_CONTEXT if the context associated with command_queue and events in event_wait_list are not the same.
|
* - CL_INVALID_CONTEXT if the context associated with command_queue and events in event_wait_list
|
||||||
|
* are not the same.
|
||||||
* - CL_INVALID_VALUE if the thread_trace is invalid thread trace object .
|
* - CL_INVALID_VALUE if the thread_trace is invalid thread trace object .
|
||||||
* - CL_INVALID_VALUE if the invalid command name enum value , not described in the cl_threadtrace_command_name_amd, is used.
|
* - CL_INVALID_VALUE if the invalid command name enum value , not described in the
|
||||||
|
* cl_threadtrace_command_name_amd, is used.
|
||||||
* - CL_INVALID_OPERATION if the command enqueue failed. It can happen in the following cases:
|
* - CL_INVALID_OPERATION if the command enqueue failed. It can happen in the following cases:
|
||||||
* o BEGIN_COMMAND is queued for thread trace object for which memory object/s was/were not bound..
|
* o BEGIN_COMMAND is queued for thread trace object for which memory object/s was/were not
|
||||||
|
* bound..
|
||||||
* o END_COMMAND is queued for thread trace object, for which BEGIN_COMMAND was not queued.
|
* o END_COMMAND is queued for thread trace object, for which BEGIN_COMMAND was not queued.
|
||||||
* o PAUSE_COMMAND is queued for thread trace object, for which BEGIN_COMMAND was not queued.
|
* o PAUSE_COMMAND is queued for thread trace object, for which BEGIN_COMMAND was not
|
||||||
* o RESUME_COMMAND is queued for thread trace object, for which PAUSE_COMMAND was not queued.
|
* queued.
|
||||||
* - CL_INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or event_wait_list is not NULL and num_events_in_wait_list is 0, or if event objects in event_wait_list are not valid events.
|
* o RESUME_COMMAND is queued for thread trace object, for which PAUSE_COMMAND was not
|
||||||
* - CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.
|
* queued.
|
||||||
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.
|
* - CL_INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or
|
||||||
|
* event_wait_list is not NULL and num_events_in_wait_list is 0, or if event objects in
|
||||||
|
* event_wait_list are not valid events.
|
||||||
|
* - CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL
|
||||||
|
* implementation on the device.
|
||||||
|
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL
|
||||||
|
* implementation on the host.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
RUNTIME_ENTRY(cl_int, clEnqueueThreadTraceCommandAMD ,(
|
RUNTIME_ENTRY(cl_int, clEnqueueThreadTraceCommandAMD,
|
||||||
cl_command_queue command_queue ,
|
(cl_command_queue command_queue, cl_threadtrace_amd thread_trace,
|
||||||
cl_threadtrace_amd thread_trace ,
|
cl_threadtrace_command_name_amd command_name, cl_uint num_events_in_wait_list,
|
||||||
cl_threadtrace_command_name_amd command_name ,
|
const cl_event* event_wait_list, cl_event* event)) {
|
||||||
cl_uint num_events_in_wait_list ,
|
// Check if command queue is valid
|
||||||
const cl_event* event_wait_list ,
|
if (!is_valid(command_queue)) {
|
||||||
cl_event* event ))
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
{
|
}
|
||||||
// Check if command queue is valid
|
|
||||||
if (!is_valid(command_queue)) {
|
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if thread trace is valid
|
// Check if thread trace is valid
|
||||||
if (!is_valid(thread_trace)) {
|
if (!is_valid(thread_trace)) {
|
||||||
|
return CL_INVALID_OPERATION;
|
||||||
|
}
|
||||||
|
|
||||||
|
amd::ThreadTrace* amdThreadTrace = as_amd(thread_trace);
|
||||||
|
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
||||||
|
if (NULL == hostQueue) {
|
||||||
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check that device associated with the command queue is the same as with thread trace
|
||||||
|
if (&hostQueue->device() != &amdThreadTrace->device()) {
|
||||||
|
return CL_INVALID_DEVICE;
|
||||||
|
}
|
||||||
|
|
||||||
|
amd::Command::EventWaitList eventWaitList;
|
||||||
|
cl_int err = amd::clSetEventWaitList(eventWaitList, hostQueue->context(), num_events_in_wait_list,
|
||||||
|
event_wait_list);
|
||||||
|
if (err != CL_SUCCESS) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a new command for the threadTraces
|
||||||
|
amd::ThreadTraceCommand* command = NULL;
|
||||||
|
switch (command_name) {
|
||||||
|
case CL_THREAD_TRACE_BEGIN_COMMAND:
|
||||||
|
if ((amdThreadTrace->getState() != amd::ThreadTrace::MemoryBound) &&
|
||||||
|
(amdThreadTrace->getState() != amd::ThreadTrace::End)) {
|
||||||
return CL_INVALID_OPERATION;
|
return CL_INVALID_OPERATION;
|
||||||
}
|
}
|
||||||
|
amdThreadTrace->setState(amd::ThreadTrace::Begin);
|
||||||
|
command = new amd::ThreadTraceCommand(
|
||||||
|
*hostQueue, eventWaitList, static_cast<const void*>(&amdThreadTrace->threadTraceConfig()),
|
||||||
|
*amdThreadTrace, amd::ThreadTraceCommand::Begin, CL_COMMAND_THREAD_TRACE);
|
||||||
|
break;
|
||||||
|
case CL_THREAD_TRACE_END_COMMAND:
|
||||||
|
if ((amdThreadTrace->getState() != amd::ThreadTrace::Begin) &&
|
||||||
|
(amdThreadTrace->getState() != amd::ThreadTrace::Pause)) {
|
||||||
|
return CL_INVALID_OPERATION;
|
||||||
|
}
|
||||||
|
amdThreadTrace->setState(amd::ThreadTrace::End);
|
||||||
|
command = new amd::ThreadTraceCommand(*hostQueue, eventWaitList,
|
||||||
|
&amdThreadTrace->threadTraceConfig(), *amdThreadTrace,
|
||||||
|
amd::ThreadTraceCommand::End, CL_COMMAND_THREAD_TRACE);
|
||||||
|
break;
|
||||||
|
case CL_THREAD_TRACE_PAUSE_COMMAND:
|
||||||
|
if (amdThreadTrace->getState() != amd::ThreadTrace::Begin) {
|
||||||
|
return CL_INVALID_OPERATION;
|
||||||
|
}
|
||||||
|
amdThreadTrace->setState(amd::ThreadTrace::Pause);
|
||||||
|
command = new amd::ThreadTraceCommand(
|
||||||
|
*hostQueue, eventWaitList, &amdThreadTrace->threadTraceConfig(), *amdThreadTrace,
|
||||||
|
amd::ThreadTraceCommand::Pause, CL_COMMAND_THREAD_TRACE);
|
||||||
|
break;
|
||||||
|
case CL_THREAD_TRACE_RESUME_COMMAND:
|
||||||
|
if (amdThreadTrace->getState() != amd::ThreadTrace::Pause) {
|
||||||
|
return CL_INVALID_OPERATION;
|
||||||
|
}
|
||||||
|
amdThreadTrace->setState(amd::ThreadTrace::Begin);
|
||||||
|
command = new amd::ThreadTraceCommand(
|
||||||
|
*hostQueue, eventWaitList, &amdThreadTrace->threadTraceConfig(), *amdThreadTrace,
|
||||||
|
amd::ThreadTraceCommand::Resume, CL_COMMAND_THREAD_TRACE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
amd::ThreadTrace* amdThreadTrace = as_amd(thread_trace);
|
if (command == NULL) {
|
||||||
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
return CL_OUT_OF_HOST_MEMORY;
|
||||||
if (NULL == hostQueue) {
|
}
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check that device associated with the command queue is the same as with thread trace
|
// Submit the command to the device
|
||||||
if (&hostQueue->device() != &amdThreadTrace->device()) {
|
command->enqueue();
|
||||||
return CL_INVALID_DEVICE;
|
|
||||||
}
|
|
||||||
|
|
||||||
amd::Command::EventWaitList eventWaitList;
|
*not_null(event) = as_cl(&command->event());
|
||||||
cl_int err = amd::clSetEventWaitList(eventWaitList,
|
if (event == NULL) {
|
||||||
hostQueue->context(), num_events_in_wait_list, event_wait_list);
|
command->release();
|
||||||
if (err != CL_SUCCESS){
|
}
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a new command for the threadTraces
|
return CL_SUCCESS;
|
||||||
amd::ThreadTraceCommand* command = NULL;
|
|
||||||
switch (command_name) {
|
|
||||||
case CL_THREAD_TRACE_BEGIN_COMMAND :
|
|
||||||
if ((amdThreadTrace->getState() != amd::ThreadTrace::MemoryBound)
|
|
||||||
&&(amdThreadTrace->getState() != amd::ThreadTrace::End)) {
|
|
||||||
return CL_INVALID_OPERATION;
|
|
||||||
}
|
|
||||||
amdThreadTrace->setState(amd::ThreadTrace::Begin);
|
|
||||||
command = new amd::ThreadTraceCommand(*hostQueue, eventWaitList,static_cast<const void*>(&amdThreadTrace->threadTraceConfig()),
|
|
||||||
*amdThreadTrace,amd::ThreadTraceCommand::Begin,CL_COMMAND_THREAD_TRACE);
|
|
||||||
break;
|
|
||||||
case CL_THREAD_TRACE_END_COMMAND :
|
|
||||||
if ((amdThreadTrace->getState() != amd::ThreadTrace::Begin)
|
|
||||||
&&(amdThreadTrace->getState() != amd::ThreadTrace::Pause)) {
|
|
||||||
return CL_INVALID_OPERATION;
|
|
||||||
}
|
|
||||||
amdThreadTrace->setState(amd::ThreadTrace::End);
|
|
||||||
command = new amd::ThreadTraceCommand(*hostQueue, eventWaitList,&amdThreadTrace->threadTraceConfig(),
|
|
||||||
*amdThreadTrace,amd::ThreadTraceCommand::End,CL_COMMAND_THREAD_TRACE);
|
|
||||||
break;
|
|
||||||
case CL_THREAD_TRACE_PAUSE_COMMAND :
|
|
||||||
if (amdThreadTrace->getState() != amd::ThreadTrace::Begin) {
|
|
||||||
return CL_INVALID_OPERATION;
|
|
||||||
}
|
|
||||||
amdThreadTrace->setState(amd::ThreadTrace::Pause);
|
|
||||||
command = new amd::ThreadTraceCommand(*hostQueue, eventWaitList,&amdThreadTrace->threadTraceConfig(),
|
|
||||||
*amdThreadTrace,amd::ThreadTraceCommand::Pause,CL_COMMAND_THREAD_TRACE);
|
|
||||||
break;
|
|
||||||
case CL_THREAD_TRACE_RESUME_COMMAND :
|
|
||||||
if (amdThreadTrace->getState() != amd::ThreadTrace::Pause) {
|
|
||||||
return CL_INVALID_OPERATION;
|
|
||||||
}
|
|
||||||
amdThreadTrace->setState(amd::ThreadTrace::Begin);
|
|
||||||
command = new amd::ThreadTraceCommand(*hostQueue, eventWaitList,&amdThreadTrace->threadTraceConfig(),
|
|
||||||
*amdThreadTrace,amd::ThreadTraceCommand::Resume,CL_COMMAND_THREAD_TRACE);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (command == NULL) {
|
|
||||||
return CL_OUT_OF_HOST_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Submit the command to the device
|
|
||||||
command->enqueue();
|
|
||||||
|
|
||||||
*not_null(event) = as_cl(&command->event());
|
|
||||||
if (event == NULL) {
|
|
||||||
command->release();
|
|
||||||
}
|
|
||||||
|
|
||||||
return CL_SUCCESS;
|
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
//
|
//
|
||||||
///*! \brief Enqueues the binding command to bind cl_threadtrace_amd to cl_mem object for trace recording..
|
///*! \brief Enqueues the binding command to bind cl_threadtrace_amd to cl_mem object for trace
|
||||||
|
///recording..
|
||||||
// *
|
// *
|
||||||
// * \param command_queue must be a valid OpenCL command queue.
|
// * \param command_queue must be a valid OpenCL command queue.
|
||||||
// *
|
// *
|
||||||
@@ -421,95 +418,97 @@ RUNTIME_EXIT
|
|||||||
// * wait for this command to complete.
|
// * wait for this command to complete.
|
||||||
// * \return A non zero value if OpenCL failed to set threadTrace buffer parameter
|
// * \return A non zero value if OpenCL failed to set threadTrace buffer parameter
|
||||||
// * - CL_INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue.
|
// * - CL_INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue.
|
||||||
// * - CL_INVALID_CONTEXT if the context associated with command_queue and events in event_wait_list are not the same.
|
// * - CL_INVALID_CONTEXT if the context associated with command_queue and events in
|
||||||
|
// event_wait_list are not the same.
|
||||||
// * - CL_INVALID_VALUE if the thread_trace is invalid thread trace object.
|
// * - CL_INVALID_VALUE if the thread_trace is invalid thread trace object.
|
||||||
// * - CL_INVALID_VALUE if the buffer_size is negative or zero.
|
// * - CL_INVALID_VALUE if the buffer_size is negative or zero.
|
||||||
// * - CL_INVALID_VALUE if the sub_buffers_num I less than 1.
|
// * - CL_INVALID_VALUE if the sub_buffers_num I less than 1.
|
||||||
// * - CL_INVALID_OPERATION if the mem_objects_num is not equal to the number of Shader Engines of the [GPU] device.
|
// * - CL_INVALID_OPERATION if the mem_objects_num is not equal to the number of Shader Engines of
|
||||||
// * - CL_INVALID_MEM_OBJECT if one on memory objects in the mem_objects array is not a valid memory object or memory_objects is NULL.
|
// the [GPU] device.
|
||||||
// * - CL_MEM_OBJECT_ALLOCATION_FAILURE if there is a failure to allocate memory for the data store associated from the memory objects of the mem_objects array.
|
// * - CL_INVALID_MEM_OBJECT if one on memory objects in the mem_objects array is not a valid
|
||||||
// * - CL_INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or event_wait_list is not NULL and num_events_in_wait_list is 0, or if event objects in event_wait_list are not valid events.
|
// memory object or memory_objects is NULL.
|
||||||
// * - CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.
|
// * - CL_MEM_OBJECT_ALLOCATION_FAILURE if there is a failure to allocate memory for the data store
|
||||||
|
// associated from the memory objects of the mem_objects array.
|
||||||
|
// * - CL_INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or
|
||||||
|
// event_wait_list is not NULL and num_events_in_wait_list is 0, or if event objects in
|
||||||
|
// event_wait_list are not valid events.
|
||||||
|
// * - CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL
|
||||||
|
// implementation on the device.
|
||||||
// * - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the
|
// * - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the
|
||||||
// * OpenCL implementation on the host.
|
// * OpenCL implementation on the host.
|
||||||
// */
|
// */
|
||||||
RUNTIME_ENTRY(cl_int,clEnqueueBindThreadTraceBufferAMD ,(cl_command_queue command_queue ,
|
RUNTIME_ENTRY(cl_int, clEnqueueBindThreadTraceBufferAMD,
|
||||||
cl_threadtrace_amd thread_trace ,
|
(cl_command_queue command_queue, cl_threadtrace_amd thread_trace, cl_mem* mem_objects,
|
||||||
cl_mem* mem_objects ,
|
cl_uint mem_objects_num, cl_uint buffer_size, cl_uint num_events_in_wait_list,
|
||||||
cl_uint mem_objects_num ,
|
const cl_event* event_wait_list, cl_event* event)) {
|
||||||
cl_uint buffer_size ,
|
// Check if command queue is valid
|
||||||
cl_uint num_events_in_wait_list ,
|
if (!is_valid(command_queue)) {
|
||||||
const cl_event* event_wait_list ,
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
cl_event* event ))
|
}
|
||||||
{
|
|
||||||
// Check if command queue is valid
|
|
||||||
if (!is_valid(command_queue)) {
|
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if thread trace is valid
|
// Check if thread trace is valid
|
||||||
if (!is_valid(thread_trace)) {
|
if (!is_valid(thread_trace)) {
|
||||||
return CL_INVALID_OPERATION;
|
return CL_INVALID_OPERATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if input values are valid
|
// Check if input values are valid
|
||||||
if ((mem_objects == NULL)
|
if ((mem_objects == NULL) || (buffer_size <= 0)) {
|
||||||
|| (buffer_size <= 0)) {
|
return CL_INVALID_VALUE;
|
||||||
return CL_INVALID_VALUE;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
amd::ThreadTrace* amdThreadTrace = as_amd(thread_trace);
|
amd::ThreadTrace* amdThreadTrace = as_amd(thread_trace);
|
||||||
|
|
||||||
// Check if the number of bound memory objects is the same as the number of SEs
|
// Check if the number of bound memory objects is the same as the number of SEs
|
||||||
if (amdThreadTrace->deviceSeNumThreadTrace() != mem_objects_num) {
|
if (amdThreadTrace->deviceSeNumThreadTrace() != mem_objects_num) {
|
||||||
return CL_INVALID_OPERATION;
|
return CL_INVALID_OPERATION;
|
||||||
}
|
}
|
||||||
// Check if memory objects ,bound the thread trace,are valid
|
// Check if memory objects ,bound the thread trace,are valid
|
||||||
for (size_t i = 0; i < mem_objects_num; ++i) {
|
for (size_t i = 0; i < mem_objects_num; ++i) {
|
||||||
cl_mem obj = mem_objects[i];
|
cl_mem obj = mem_objects[i];
|
||||||
if (!is_valid(obj)) {
|
if (!is_valid(obj)) {
|
||||||
return CL_INVALID_MEM_OBJECT;
|
return CL_INVALID_MEM_OBJECT;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
|
||||||
if (NULL == hostQueue) {
|
if (NULL == hostQueue) {
|
||||||
return CL_INVALID_COMMAND_QUEUE;
|
return CL_INVALID_COMMAND_QUEUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that device associated with the command queue is the same as with thread trace
|
// Check that device associated with the command queue is the same as with thread trace
|
||||||
if (&hostQueue->device() != &amdThreadTrace->device()) {
|
if (&hostQueue->device() != &amdThreadTrace->device()) {
|
||||||
return CL_INVALID_DEVICE;
|
return CL_INVALID_DEVICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
amd::Command::EventWaitList eventWaitList;
|
amd::Command::EventWaitList eventWaitList;
|
||||||
cl_int err = amd::clSetEventWaitList(eventWaitList,
|
cl_int err = amd::clSetEventWaitList(eventWaitList, hostQueue->context(), num_events_in_wait_list,
|
||||||
hostQueue->context(), num_events_in_wait_list, event_wait_list);
|
event_wait_list);
|
||||||
if (err != CL_SUCCESS){
|
if (err != CL_SUCCESS) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
amdThreadTrace->setState(amd::ThreadTrace::MemoryBound);
|
amdThreadTrace->setState(amd::ThreadTrace::MemoryBound);
|
||||||
// Create a new ThreadTraceMemObjectsCommand command
|
// Create a new ThreadTraceMemObjectsCommand command
|
||||||
amd::ThreadTraceMemObjectsCommand* command =
|
amd::ThreadTraceMemObjectsCommand* command = new amd::ThreadTraceMemObjectsCommand(
|
||||||
new amd::ThreadTraceMemObjectsCommand(*hostQueue, eventWaitList, mem_objects_num,mem_objects,buffer_size,*amdThreadTrace,CL_COMMAND_THREAD_TRACE_MEM);
|
*hostQueue, eventWaitList, mem_objects_num, mem_objects, buffer_size, *amdThreadTrace,
|
||||||
if (command == NULL) {
|
CL_COMMAND_THREAD_TRACE_MEM);
|
||||||
return CL_OUT_OF_HOST_MEMORY;
|
if (command == NULL) {
|
||||||
}
|
return CL_OUT_OF_HOST_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure we have memory for the command execution
|
// Make sure we have memory for the command execution
|
||||||
if (!command->validateMemory()) {
|
if (!command->validateMemory()) {
|
||||||
delete command;
|
delete command;
|
||||||
return CL_OUT_OF_RESOURCES;
|
return CL_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
// Submit the command to the device
|
// Submit the command to the device
|
||||||
command->enqueue();
|
command->enqueue();
|
||||||
|
|
||||||
*not_null(event) = as_cl(&command->event());
|
*not_null(event) = as_cl(&command->event());
|
||||||
if (event == NULL) {
|
if (event == NULL) {
|
||||||
command->release();
|
command->release();
|
||||||
}
|
}
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
RUNTIME_EXIT
|
RUNTIME_EXIT
|
||||||
|
|
||||||
|
|||||||
@@ -99,140 +99,136 @@ jurisdiction and venue of these courts.
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /*__cplusplus*/
|
#endif /*__cplusplus*/
|
||||||
|
|
||||||
typedef struct _cl_threadtrace_amd * cl_threadtrace_amd;
|
typedef struct _cl_threadtrace_amd* cl_threadtrace_amd;
|
||||||
typedef cl_uint cl_thread_trace_param;
|
typedef cl_uint cl_thread_trace_param;
|
||||||
typedef cl_uint cl_threadtrace_info;
|
typedef cl_uint cl_threadtrace_info;
|
||||||
|
|
||||||
/* cl_command_type */
|
/* cl_command_type */
|
||||||
#define CL_COMMAND_THREAD_TRACE_MEM 0x4500
|
#define CL_COMMAND_THREAD_TRACE_MEM 0x4500
|
||||||
#define CL_COMMAND_THREAD_TRACE 0x4501
|
#define CL_COMMAND_THREAD_TRACE 0x4501
|
||||||
|
|
||||||
/* cl_threadtrace_command_name_amd enumeration */
|
/* cl_threadtrace_command_name_amd enumeration */
|
||||||
typedef enum _cl_threadtrace_command_name_amd {
|
typedef enum _cl_threadtrace_command_name_amd {
|
||||||
CL_THREAD_TRACE_BEGIN_COMMAND,
|
CL_THREAD_TRACE_BEGIN_COMMAND,
|
||||||
CL_THREAD_TRACE_END_COMMAND,
|
CL_THREAD_TRACE_END_COMMAND,
|
||||||
CL_THREAD_TRACE_PAUSE_COMMAND,
|
CL_THREAD_TRACE_PAUSE_COMMAND,
|
||||||
CL_THREAD_TRACE_RESUME_COMMAND
|
CL_THREAD_TRACE_RESUME_COMMAND
|
||||||
} cl_threadtrace_command_name_amd;
|
} cl_threadtrace_command_name_amd;
|
||||||
|
|
||||||
// Thread trace parameters
|
// Thread trace parameters
|
||||||
enum ThreadTraceParameter
|
enum ThreadTraceParameter {
|
||||||
{
|
CL_THREAD_TRACE_PARAM_TOKEN_MASK,
|
||||||
CL_THREAD_TRACE_PARAM_TOKEN_MASK,
|
CL_THREAD_TRACE_PARAM_REG_MASK,
|
||||||
CL_THREAD_TRACE_PARAM_REG_MASK,
|
CL_THREAD_TRACE_PARAM_COMPUTE_UNIT_TARGET,
|
||||||
CL_THREAD_TRACE_PARAM_COMPUTE_UNIT_TARGET,
|
CL_THREAD_TRACE_PARAM_SHADER_ARRAY_TARGET,
|
||||||
CL_THREAD_TRACE_PARAM_SHADER_ARRAY_TARGET,
|
CL_THREAD_TRACE_PARAM_SIMD_MASK,
|
||||||
CL_THREAD_TRACE_PARAM_SIMD_MASK,
|
CL_THREAD_TRACE_PARAM_VM_ID_MASK,
|
||||||
CL_THREAD_TRACE_PARAM_VM_ID_MASK,
|
CL_THREAD_TRACE_PARAM_RANDOM_SEED,
|
||||||
CL_THREAD_TRACE_PARAM_RANDOM_SEED,
|
CL_THREAD_TRACE_PARAM_CAPTURE_MODE,
|
||||||
CL_THREAD_TRACE_PARAM_CAPTURE_MODE,
|
CL_THREAD_TRACE_PARAM_INSTRUCTION_MASK,
|
||||||
CL_THREAD_TRACE_PARAM_INSTRUCTION_MASK,
|
CL_THREAD_TRACE_PARAM_USER_DATA,
|
||||||
CL_THREAD_TRACE_PARAM_USER_DATA,
|
CL_THREAD_TRACE_PARAM_IS_WRAPPED
|
||||||
CL_THREAD_TRACE_PARAM_IS_WRAPPED
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// CL_THREAD_TRACE_PARAM_TOKEN_MASK data selects for SI
|
// CL_THREAD_TRACE_PARAM_TOKEN_MASK data selects for SI
|
||||||
enum CL_THREAD_TRACE_TOKEN_MASK
|
enum CL_THREAD_TRACE_TOKEN_MASK {
|
||||||
{
|
// Time passed
|
||||||
//Time passed
|
CL_THREAD_TRACE_TOKEN_MASK_TIME_SI = 0x00000001,
|
||||||
CL_THREAD_TRACE_TOKEN_MASK_TIME_SI = 0x00000001,
|
// Resync the timestamp
|
||||||
//Resync the timestamp
|
CL_THREAD_TRACE_TOKEN_MASK_TIMESTAMP_SI = 0x00000002,
|
||||||
CL_THREAD_TRACE_TOKEN_MASK_TIMESTAMP_SI = 0x00000002,
|
// A register write has occurred
|
||||||
//A register write has occurred
|
CL_THREAD_TRACE_TOKEN_MASK_REG_SI = 0x00000004,
|
||||||
CL_THREAD_TRACE_TOKEN_MASK_REG_SI = 0x00000004,
|
// A wavefront has started
|
||||||
//A wavefront has started
|
CL_THREAD_TRACE_TOKEN_MASK_WAVE_START_SI = 0x00000008,
|
||||||
CL_THREAD_TRACE_TOKEN_MASK_WAVE_START_SI = 0x00000008,
|
// Output space has been allocated for color/Z [Should be used for cl-gl]
|
||||||
//Output space has been allocated for color/Z [Should be used for cl-gl]
|
CL_THREAD_TRACE_TOKEN_MASK_WAVE_PS_ALLOC_SI = 0x00000010,
|
||||||
CL_THREAD_TRACE_TOKEN_MASK_WAVE_PS_ALLOC_SI = 0x00000010,
|
// Output space has been allocated for vertex position [Should be used for cl-gl]
|
||||||
//Output space has been allocated for vertex position [Should be used for cl-gl]
|
CL_THREAD_TRACE_TOKEN_MASK_WAVE_VS_ALLOC_SI = 0x00000020,
|
||||||
CL_THREAD_TRACE_TOKEN_MASK_WAVE_VS_ALLOC_SI = 0x00000020,
|
// Wavefront completion
|
||||||
//Wavefront completion
|
CL_THREAD_TRACE_TOKEN_MASK_WAVE_END_SI = 0x00000040,
|
||||||
CL_THREAD_TRACE_TOKEN_MASK_WAVE_END_SI = 0x00000040,
|
// An event has reached the top of a shader stage. In-order with WAVE_START
|
||||||
//An event has reached the top of a shader stage. In-order with WAVE_START
|
CL_THREAD_TRACE_TOKEN_MASK_EVENT_SI = 0x00000080,
|
||||||
CL_THREAD_TRACE_TOKEN_MASK_EVENT_SI = 0x00000080,
|
// An event has reached the top of a compute shader stage. In-order with WAVE_START
|
||||||
//An event has reached the top of a compute shader stage. In-order with WAVE_START
|
CL_THREAD_TRACE_TOKEN_MASK_EVENT_CS_SI = 0x00000100,
|
||||||
CL_THREAD_TRACE_TOKEN_MASK_EVENT_CS_SI = 0x00000100,
|
// An event has reached the top of a shader stage for the second GFX pipe. In-order with
|
||||||
//An event has reached the top of a shader stage for the second GFX pipe. In-order with WAVE_START.
|
// WAVE_START.
|
||||||
//[Should be used for cl-gl]
|
//[Should be used for cl-gl]
|
||||||
CL_THREAD_TRACE_TOKEN_MASK_EVENT_GFX_SI = 0x00000200,
|
CL_THREAD_TRACE_TOKEN_MASK_EVENT_GFX_SI = 0x00000200,
|
||||||
//The kernel has executed an instruction
|
// The kernel has executed an instruction
|
||||||
CL_THREAD_TRACE_TOKEN_MASK_INST_SI = 0x00000400,
|
CL_THREAD_TRACE_TOKEN_MASK_INST_SI = 0x00000400,
|
||||||
//The kernel has explicitly written the PC value
|
// The kernel has explicitly written the PC value
|
||||||
CL_THREAD_TRACE_TOKEN_MASK_INST_PC_SI = 0x00000800,
|
CL_THREAD_TRACE_TOKEN_MASK_INST_PC_SI = 0x00000800,
|
||||||
//The kernel has written user data into the thread trace buffer
|
// The kernel has written user data into the thread trace buffer
|
||||||
CL_THREAD_TRACE_TOKEN_MASK_INST_USERDATA_SI = 0x00001000,
|
CL_THREAD_TRACE_TOKEN_MASK_INST_USERDATA_SI = 0x00001000,
|
||||||
//Provides information about instruction scheduling
|
// Provides information about instruction scheduling
|
||||||
CL_THREAD_TRACE_TOKEN_MASK_ISSUE_SI = 0x00002000,
|
CL_THREAD_TRACE_TOKEN_MASK_ISSUE_SI = 0x00002000,
|
||||||
//The performance counter delta has been updated
|
// The performance counter delta has been updated
|
||||||
CL_THREAD_TRACE_TOKEN_MASK_PERF_SI = 0x00004000,
|
CL_THREAD_TRACE_TOKEN_MASK_PERF_SI = 0x00004000,
|
||||||
//A miscellaneous event has been sent
|
// A miscellaneous event has been sent
|
||||||
CL_THREAD_TRACE_TOKEN_MASK_MISC_SI = 0x00008000,
|
CL_THREAD_TRACE_TOKEN_MASK_MISC_SI = 0x00008000,
|
||||||
//All possible tokens
|
// All possible tokens
|
||||||
CL_THREAD_TRACE_TOKEN_MASK_ALL_SI = 0x0000ffff,
|
CL_THREAD_TRACE_TOKEN_MASK_ALL_SI = 0x0000ffff,
|
||||||
};
|
};
|
||||||
|
|
||||||
//CL_THREAD_TRACE_PARAM_REG_MASK data selects
|
// CL_THREAD_TRACE_PARAM_REG_MASK data selects
|
||||||
enum CL_THREAD_TRACE_REG_MASK
|
enum CL_THREAD_TRACE_REG_MASK {
|
||||||
{
|
// Event initiator
|
||||||
//Event initiator
|
CL_THREAD_TRACE_REG_MASK_EVENT_SI = 0x00000001,
|
||||||
CL_THREAD_TRACE_REG_MASK_EVENT_SI = 0x00000001,
|
// Draw initiator [Should be used for cl-gl]
|
||||||
//Draw initiator [Should be used for cl-gl]
|
CL_THREAD_TRACE_REG_MASK_DRAW_SI = 0x00000002,
|
||||||
CL_THREAD_TRACE_REG_MASK_DRAW_SI = 0x00000002,
|
// Dispatch initiator
|
||||||
//Dispatch initiator
|
CL_THREAD_TRACE_REG_MASK_DISPATCH_SI = 0x00000004,
|
||||||
CL_THREAD_TRACE_REG_MASK_DISPATCH_SI = 0x00000004,
|
// User data from host
|
||||||
//User data from host
|
CL_THREAD_TRACE_REG_MASK_USERDATA_SI = 0x00000008,
|
||||||
CL_THREAD_TRACE_REG_MASK_USERDATA_SI = 0x00000008,
|
// GFXDEC register (8-state) [Should be used for cl-gl]
|
||||||
//GFXDEC register (8-state) [Should be used for cl-gl]
|
CL_THREAD_TRACE_REG_MASK_GFXDEC_SI = 0x00000020,
|
||||||
CL_THREAD_TRACE_REG_MASK_GFXDEC_SI = 0x00000020,
|
// SHDEC register (many state)
|
||||||
//SHDEC register (many state)
|
CL_THREAD_TRACE_REG_MASK_SHDEC_SI = 0x00000040,
|
||||||
CL_THREAD_TRACE_REG_MASK_SHDEC_SI = 0x00000040,
|
// Other registers
|
||||||
//Other registers
|
CL_THREAD_TRACE_REG_MASK_OTHER_SI = 0x00000080,
|
||||||
CL_THREAD_TRACE_REG_MASK_OTHER_SI = 0x00000080,
|
// All possible registers types
|
||||||
//All possible registers types
|
CL_THREAD_TRACE_REG_MASK_ALL_SI = 0x000000ff,
|
||||||
CL_THREAD_TRACE_REG_MASK_ALL_SI = 0x000000ff,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//CL_THREAD_TRACE_PARAM_VM_ID_MASK data selects
|
// CL_THREAD_TRACE_PARAM_VM_ID_MASK data selects
|
||||||
enum CL_THREAD_TRACE_VM_ID_MASK
|
enum CL_THREAD_TRACE_VM_ID_MASK {
|
||||||
{
|
// Capture only data from the VM_ID used to write {SQTT}_BASE
|
||||||
//Capture only data from the VM_ID used to write {SQTT}_BASE
|
CL_THREAD_TRACE_VM_ID_MASK_SINGLE = 0,
|
||||||
CL_THREAD_TRACE_VM_ID_MASK_SINGLE = 0,
|
// Capture all data from all VM_IDs
|
||||||
//Capture all data from all VM_IDs
|
CL_THREAD_TRACE_VM_ID_MASK_ALL = 1,
|
||||||
CL_THREAD_TRACE_VM_ID_MASK_ALL = 1,
|
// Capture all data but only get target (a.k.a. detail) data from VM_ID used to write {SQTT}_BASE
|
||||||
//Capture all data but only get target (a.k.a. detail) data from VM_ID used to write {SQTT}_BASE
|
CL_THREAD_TRACE_VM_ID_MASK_SINGLE_DETAIL = 2
|
||||||
CL_THREAD_TRACE_VM_ID_MASK_SINGLE_DETAIL = 2
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//CL_THREAD_TRACE_PARAM_CAPTURE_MODE data
|
// CL_THREAD_TRACE_PARAM_CAPTURE_MODE data
|
||||||
enum CL_THREAD_TRACE_CAPTURE_MODE
|
enum CL_THREAD_TRACE_CAPTURE_MODE {
|
||||||
{
|
// Capture all data in the thread trace buffer
|
||||||
//Capture all data in the thread trace buffer
|
CL_THREAD_TRACE_CAPTURE_ALL = 0,
|
||||||
CL_THREAD_TRACE_CAPTURE_ALL = 0,
|
// Capture only data between THREAD_TRACE_START and THREAD_TRACE_STOP events
|
||||||
//Capture only data between THREAD_TRACE_START and THREAD_TRACE_STOP events
|
CL_THREAD_TRACE_CAPTURE_SELECT = 1,
|
||||||
CL_THREAD_TRACE_CAPTURE_SELECT = 1,
|
// Capture data between THREAD_TRACE_START and THREAD_TRACE_/STOP events,
|
||||||
//Capture data between THREAD_TRACE_START and THREAD_TRACE_/STOP events,
|
// and global/reference data at all times
|
||||||
//and global/reference data at all times
|
CL_THREAD_TRACE_CAPTURE_SELECT_DETAIL = 2
|
||||||
CL_THREAD_TRACE_CAPTURE_SELECT_DETAIL = 2
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//CL_THREAD_TRACE_PARAM_INSTRUCTION_MASK data selects
|
// CL_THREAD_TRACE_PARAM_INSTRUCTION_MASK data selects
|
||||||
enum CL_THREAD_TRACE_INSTRUCTION_MASK
|
enum CL_THREAD_TRACE_INSTRUCTION_MASK {
|
||||||
{
|
// Generate {SQTT}_TOKEN_INST tokens for all instructions
|
||||||
//Generate {SQTT}_TOKEN_INST tokens for all instructions
|
CL_THREAD_TRACE_INST_MASK_ALL,
|
||||||
CL_THREAD_TRACE_INST_MASK_ALL,
|
// Generate {SQTT}_TOKEN_INST tokens for stalled instructions only
|
||||||
//Generate {SQTT}_TOKEN_INST tokens for stalled instructions only
|
CL_THREAD_TRACE_INST_MASK_STALLED,
|
||||||
CL_THREAD_TRACE_INST_MASK_STALLED,
|
// Generate {SQTT}_TOKEN_INST messages for stalled and other (no op/wait/set prio/etc)
|
||||||
//Generate {SQTT}_TOKEN_INST messages for stalled and other (no op/wait/set prio/etc) instructions
|
// instructions
|
||||||
CL_THREAD_TRACE_INST_MASK_STALLED_AND_IMMEDIATE,
|
CL_THREAD_TRACE_INST_MASK_STALLED_AND_IMMEDIATE,
|
||||||
//Generate {SQTT}_TOKEN_INST messages for immediate instructions only only [ Should be used only for CI]
|
// Generate {SQTT}_TOKEN_INST messages for immediate instructions only only [ Should be used only
|
||||||
CL_THREAD_TRACE_INST_MASK_IMMEDIATE_CI,
|
// for CI]
|
||||||
|
CL_THREAD_TRACE_INST_MASK_IMMEDIATE_CI,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ThreadTraceInfo
|
enum ThreadTraceInfo {
|
||||||
{
|
CL_THREAD_TRACE_SE,
|
||||||
CL_THREAD_TRACE_SE,
|
CL_THREAD_TRACE_BUFFERS_FILLED,
|
||||||
CL_THREAD_TRACE_BUFFERS_FILLED,
|
CL_THREAD_TRACE_BUFFERS_SIZE
|
||||||
CL_THREAD_TRACE_BUFFERS_SIZE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -251,27 +247,24 @@ enum ThreadTraceInfo
|
|||||||
*
|
*
|
||||||
* \return the created threadTrace object
|
* \return the created threadTrace object
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_threadtrace_amd CL_API_CALL
|
extern CL_API_ENTRY cl_threadtrace_amd CL_API_CALL clCreateThreadTraceAMD(
|
||||||
clCreateThreadTraceAMD(
|
cl_device_id /* device */, cl_int* /* errcode_ret */
|
||||||
cl_device_id /* device */,
|
) CL_API_SUFFIX__VERSION_1_0;
|
||||||
cl_int* /* errcode_ret */
|
|
||||||
) CL_API_SUFFIX__VERSION_1_0;
|
|
||||||
|
|
||||||
/*! \brief Destroys a cl_threadtrace_amd object.
|
/*! \brief Destroys a cl_threadtrace_amd object.
|
||||||
*
|
*
|
||||||
* \param threadTrace the cl_threadtrace_amd object for release
|
* \param threadTrace the cl_threadtrace_amd object for release
|
||||||
*
|
*
|
||||||
* \return A non zero value if OpenCL failed to release threadTrace
|
* \return A non zero value if OpenCL failed to release threadTrace
|
||||||
* -CL_INVALID_VALUE if the thread_trace is not a valid OpenCL thread trace object (cl_threadtrace_amd) .
|
* -CL_INVALID_VALUE if the thread_trace is not a valid OpenCL thread trace object
|
||||||
|
(cl_threadtrace_amd) .
|
||||||
* -CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the
|
* -CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the
|
||||||
* OpenCL implementation on the device.
|
* OpenCL implementation on the device.
|
||||||
* -CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the
|
* -CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the
|
||||||
OpenCL implementation on the host.
|
OpenCL implementation on the host.
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
extern CL_API_ENTRY cl_int CL_API_CALL clReleaseThreadTraceAMD(cl_threadtrace_amd /* threadTrace */
|
||||||
clReleaseThreadTraceAMD(
|
) CL_API_SUFFIX__VERSION_1_0;
|
||||||
cl_threadtrace_amd /* threadTrace */
|
|
||||||
) CL_API_SUFFIX__VERSION_1_0;
|
|
||||||
|
|
||||||
/*! \brief Increments the cl_threadtrace_amd object reference count.
|
/*! \brief Increments the cl_threadtrace_amd object reference count.
|
||||||
*
|
*
|
||||||
@@ -284,36 +277,36 @@ clReleaseThreadTraceAMD(
|
|||||||
* -CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the
|
* -CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the
|
||||||
OpenCL implementation on the host.
|
OpenCL implementation on the host.
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
extern CL_API_ENTRY cl_int CL_API_CALL clRetainThreadTraceAMD(cl_threadtrace_amd /* threadTrace */
|
||||||
clRetainThreadTraceAMD(
|
) CL_API_SUFFIX__VERSION_1_0;
|
||||||
cl_threadtrace_amd /* threadTrace */
|
|
||||||
) CL_API_SUFFIX__VERSION_1_0;
|
|
||||||
|
|
||||||
/*! \brief Sets the cl_threadtrace_amd object configuration parameter.
|
/*! \brief Sets the cl_threadtrace_amd object configuration parameter.
|
||||||
*
|
*
|
||||||
* \param thread_trace the cl_threadtrace_amd object to set configuration parameter
|
* \param thread_trace the cl_threadtrace_amd object to set configuration parameter
|
||||||
*
|
*
|
||||||
* \param config_param the cl_thread_trace_param
|
* \param config_param the cl_thread_trace_param
|
||||||
*
|
*
|
||||||
* \param param_value corresponding to configParam
|
* \param param_value corresponding to configParam
|
||||||
*
|
*
|
||||||
* \return A non zero value if OpenCL failed to set threadTrace buffer parameter
|
* \return A non zero value if OpenCL failed to set threadTrace buffer parameter
|
||||||
* - CL_INVALID_VALUE if the thread_trace is invalid thread trace object.
|
* - CL_INVALID_VALUE if the thread_trace is invalid thread trace object.
|
||||||
* - CL_INVALID_VALUE if the invalid config_param or param_value enum values , are used.
|
* - CL_INVALID_VALUE if the invalid config_param or param_value enum values , are used.
|
||||||
* - CL_INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or event_wait_list is not NULL and num_events_in_wait_list is 0,
|
* - CL_INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or
|
||||||
|
event_wait_list is not NULL and num_events_in_wait_list is 0,
|
||||||
* - or if event objects in event_wait_list are not valid events.
|
* - or if event objects in event_wait_list are not valid events.
|
||||||
* - CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.
|
* - CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL
|
||||||
|
implementation on the device.
|
||||||
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the
|
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the
|
||||||
OpenCL implementation on the host.
|
OpenCL implementation on the host.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
extern CL_API_ENTRY cl_int CL_API_CALL clSetThreadTraceParamAMD(
|
||||||
clSetThreadTraceParamAMD(cl_threadtrace_amd /*thread_trace*/ ,
|
cl_threadtrace_amd /*thread_trace*/, cl_thread_trace_param /*config_param*/,
|
||||||
cl_thread_trace_param /*config_param*/ ,
|
cl_uint /*param_value*/
|
||||||
cl_uint /*param_value*/
|
) CL_API_SUFFIX__VERSION_1_0;
|
||||||
)CL_API_SUFFIX__VERSION_1_0;
|
|
||||||
|
|
||||||
/* \brief Enqueues the binding command to bind cl_threadtrace_amd to cl_mem object for trace recording..
|
/* \brief Enqueues the binding command to bind cl_threadtrace_amd to cl_mem object for trace
|
||||||
|
* recording..
|
||||||
*
|
*
|
||||||
* \param command_queue must be a valid OpenCL command queue.
|
* \param command_queue must be a valid OpenCL command queue.
|
||||||
*
|
*
|
||||||
@@ -345,28 +338,30 @@ clSetThreadTraceParamAMD(cl_threadtrace_amd /*thread_trace*/ ,
|
|||||||
* wait for this command to complete.
|
* wait for this command to complete.
|
||||||
* \return A non zero value if OpenCL failed to set threadTrace buffer parameter
|
* \return A non zero value if OpenCL failed to set threadTrace buffer parameter
|
||||||
* - CL_INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue.
|
* - CL_INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue.
|
||||||
* - CL_INVALID_CONTEXT if the context associated with command_queue and events in event_wait_list are not the same.
|
* - CL_INVALID_CONTEXT if the context associated with command_queue and events in event_wait_list
|
||||||
|
* are not the same.
|
||||||
* - CL_INVALID_VALUE if the thread_trace is invalid thread trace object.
|
* - CL_INVALID_VALUE if the thread_trace is invalid thread trace object.
|
||||||
* - CL_INVALID_VALUE if the buffer_size is negative or zero.
|
* - CL_INVALID_VALUE if the buffer_size is negative or zero.
|
||||||
* - CL_INVALID_VALUE if the sub_buffers_num I less than 1.
|
* - CL_INVALID_VALUE if the sub_buffers_num I less than 1.
|
||||||
* - CL_INVALID_OPERATION if the mem_objects_num is not equal to the number of Shader Engines of the [GPU] device.
|
* - CL_INVALID_OPERATION if the mem_objects_num is not equal to the number of Shader Engines of
|
||||||
* - CL_INVALID_MEM_OBJECT if one on memory objects in the mem_objects array is not a valid memory object or memory_objects is NULL.
|
* the [GPU] device.
|
||||||
* - CL_MEM_OBJECT_ALLOCATION_FAILURE if there is a failure to allocate memory for the data store associated from the memory objects of the mem_objects array.
|
* - CL_INVALID_MEM_OBJECT if one on memory objects in the mem_objects array is not a valid memory
|
||||||
* - CL_INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or event_wait_list is not NULL and num_events_in_wait_list is 0, or if event objects in event_wait_list are not valid events.
|
* object or memory_objects is NULL.
|
||||||
* - CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.
|
* - CL_MEM_OBJECT_ALLOCATION_FAILURE if there is a failure to allocate memory for the data store
|
||||||
|
* associated from the memory objects of the mem_objects array.
|
||||||
|
* - CL_INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or
|
||||||
|
* event_wait_list is not NULL and num_events_in_wait_list is 0, or if event objects in
|
||||||
|
* event_wait_list are not valid events.
|
||||||
|
* - CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL
|
||||||
|
* implementation on the device.
|
||||||
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the
|
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the
|
||||||
* OpenCL implementation on the host.
|
* OpenCL implementation on the host.
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueBindThreadTraceBufferAMD(
|
||||||
clEnqueueBindThreadTraceBufferAMD(cl_command_queue command_queue ,
|
cl_command_queue command_queue, cl_threadtrace_amd /*thread_trace*/, cl_mem* /*mem_objects*/,
|
||||||
cl_threadtrace_amd /*thread_trace*/ ,
|
cl_uint /*mem_objects_num*/, cl_uint /*buffer_size*/, cl_uint /*num_events_in_wait_list*/,
|
||||||
cl_mem* /*mem_objects*/ ,
|
const cl_event* /*event_wait_list*/, cl_event* /*event*/
|
||||||
cl_uint /*mem_objects_num*/ ,
|
) CL_API_SUFFIX__VERSION_1_0;
|
||||||
cl_uint /*buffer_size*/ ,
|
|
||||||
cl_uint /*num_events_in_wait_list*/ ,
|
|
||||||
const cl_event* /*event_wait_list*/ ,
|
|
||||||
cl_event* /*event*/
|
|
||||||
) CL_API_SUFFIX__VERSION_1_0;
|
|
||||||
|
|
||||||
/*! \brief Get specific information about the OpenCL Thread Trace.
|
/*! \brief Get specific information about the OpenCL Thread Trace.
|
||||||
*
|
*
|
||||||
@@ -392,14 +387,10 @@ clEnqueueBindThreadTraceBufferAMD(cl_command_queue command_queue ,
|
|||||||
* OpenCL implementation on the host.
|
* OpenCL implementation on the host.
|
||||||
* CL_SUCCESS if the function is executed successfully.
|
* CL_SUCCESS if the function is executed successfully.
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
extern CL_API_ENTRY cl_int CL_API_CALL clGetThreadTraceInfoAMD(
|
||||||
clGetThreadTraceInfoAMD(
|
cl_threadtrace_amd /* thread_trace */, cl_threadtrace_info /*thread_trace_info_param*/,
|
||||||
cl_threadtrace_amd /* thread_trace */,
|
size_t /*param_value_size*/, void* /*param_value*/, size_t* /*param_value_size_ret*/
|
||||||
cl_threadtrace_info /*thread_trace_info_param*/,
|
) CL_API_SUFFIX__VERSION_1_0;
|
||||||
size_t /*param_value_size*/,
|
|
||||||
void* /*param_value*/,
|
|
||||||
size_t* /*param_value_size_ret*/
|
|
||||||
) CL_API_SUFFIX__VERSION_1_0;
|
|
||||||
|
|
||||||
/*! \brief Enqueues the thread trace command for the specified thread trace object.
|
/*! \brief Enqueues the thread trace command for the specified thread trace object.
|
||||||
*
|
*
|
||||||
@@ -409,31 +400,36 @@ clGetThreadTraceInfoAMD(
|
|||||||
*
|
*
|
||||||
* \return A non zero value if OpenCL failed to release threadTrace
|
* \return A non zero value if OpenCL failed to release threadTrace
|
||||||
* - CL_INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue.
|
* - CL_INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue.
|
||||||
* - CL_INVALID_CONTEXT if the context associated with command_queue and events in event_wait_list are not the same.
|
* - CL_INVALID_CONTEXT if the context associated with command_queue and events in event_wait_list
|
||||||
|
* are not the same.
|
||||||
* - CL_INVALID_VALUE if the thread_trace is invalid thread trace object .
|
* - CL_INVALID_VALUE if the thread_trace is invalid thread trace object .
|
||||||
* - CL_INVALID_VALUE if the invalid command name enum value , not described in the cl_threadtrace_command_name_amd, is used.
|
* - CL_INVALID_VALUE if the invalid command name enum value , not described in the
|
||||||
|
* cl_threadtrace_command_name_amd, is used.
|
||||||
* - CL_INVALID_OPERATION if the command enqueue failed. It can happen in the following cases:
|
* - CL_INVALID_OPERATION if the command enqueue failed. It can happen in the following cases:
|
||||||
* o BEGIN_COMMAND is queued for thread trace object for which memory object/s was/were not bound..
|
* o BEGIN_COMMAND is queued for thread trace object for which memory object/s was/were not
|
||||||
|
* bound..
|
||||||
* o END_COMMAND is queued for thread trace object, for which BEGIN_COMMAND was not queued.
|
* o END_COMMAND is queued for thread trace object, for which BEGIN_COMMAND was not queued.
|
||||||
* o PAUSE_COMMAND is queued for thread trace object, for which BEGIN_COMMAND was not queued.
|
* o PAUSE_COMMAND is queued for thread trace object, for which BEGIN_COMMAND was not
|
||||||
* o RESUME_COMMAND is queued for thread trace object, for which PAUSE_COMMAND was not queued.
|
* queued.
|
||||||
* - CL_INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or event_wait_list is not NULL and num_events_in_wait_list is 0, or if event objects in event_wait_list are not valid events.
|
* o RESUME_COMMAND is queued for thread trace object, for which PAUSE_COMMAND was not
|
||||||
* - CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.
|
* queued.
|
||||||
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.
|
* - CL_INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or
|
||||||
|
* event_wait_list is not NULL and num_events_in_wait_list is 0, or if event objects in
|
||||||
|
* event_wait_list are not valid events.
|
||||||
|
* - CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL
|
||||||
|
* implementation on the device.
|
||||||
|
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL
|
||||||
|
* implementation on the host.
|
||||||
*/
|
*/
|
||||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueThreadTraceCommandAMD(
|
||||||
clEnqueueThreadTraceCommandAMD(
|
cl_command_queue /*command_queue*/, cl_threadtrace_amd /*thread_trace*/,
|
||||||
cl_command_queue /*command_queue*/ ,
|
cl_threadtrace_command_name_amd /*command_name*/, cl_uint /*num_events_in_wait_list*/,
|
||||||
cl_threadtrace_amd /*thread_trace*/ ,
|
const cl_event* /*event_wait_list*/, cl_event* /*event*/
|
||||||
cl_threadtrace_command_name_amd /*command_name*/ ,
|
) CL_API_SUFFIX__VERSION_1_0;
|
||||||
cl_uint /*num_events_in_wait_list*/ ,
|
|
||||||
const cl_event* /*event_wait_list*/,
|
|
||||||
cl_event* /*event*/
|
|
||||||
)CL_API_SUFFIX__VERSION_1_0;
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /*extern "C"*/
|
} /*extern "C"*/
|
||||||
#endif /*__cplusplus*/
|
#endif /*__cplusplus*/
|
||||||
|
|
||||||
#endif /*__CL_THREAD_TRACE_AMD_H*/
|
#endif /*__CL_THREAD_TRACE_AMD_H*/
|
||||||
|
|||||||
Reference in New Issue
Block a user