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:
foreman
2017-04-13 13:56:38 -04:00
rodzic 72aa0e70ee
commit 9155ca37e5
36 zmienionych plików z 12391 dodań i 14627 usunięć
+10
Wyświetl plik
@@ -0,0 +1,10 @@
Language: Cpp
BasedOnStyle: Google
AlignEscapedNewlinesLeft: false
AlignOperands: false
ColumnLimit: 100
AlwaysBreakTemplateDeclarations: false
DerivePointerAlignment: false
IndentFunctionDeclarationAfterType: false
MaxEmptyLinesToKeep: 2
SortIncludes: false
+83 -137
Wyświetl plik
@@ -107,203 +107,149 @@ typedef const struct _cl_agent cl_agent;
/* Context Callbacks */
typedef void (CL_CALLBACK * acContextCreate_fn)(
cl_agent * /* agent */,
cl_context /* context */);
typedef void(CL_CALLBACK* acContextCreate_fn)(cl_agent* /* agent */, cl_context /* context */);
typedef void (CL_CALLBACK * acContextFree_fn)(
cl_agent * /* agent */,
cl_context /* context */);
typedef void(CL_CALLBACK* acContextFree_fn)(cl_agent* /* agent */, cl_context /* context */);
/* Command Queue Callbacks */
typedef void (CL_CALLBACK * acCommandQueueCreate_fn)(
cl_agent * /* agent */,
cl_command_queue /* queue */);
typedef void(CL_CALLBACK* acCommandQueueCreate_fn)(cl_agent* /* agent */,
cl_command_queue /* queue */);
typedef void (CL_CALLBACK * acCommandQueueFree_fn)(
cl_agent * /* agent */,
cl_command_queue /* queue */);
typedef void(CL_CALLBACK* acCommandQueueFree_fn)(cl_agent* /* agent */,
cl_command_queue /* queue */);
/* Event Callbacks */
typedef void (CL_CALLBACK * acEventCreate_fn)(
cl_agent * /* agent */,
cl_event /* event */,
cl_command_type /* type */);
typedef void(CL_CALLBACK* acEventCreate_fn)(cl_agent* /* agent */, cl_event /* event */,
cl_command_type /* type */);
typedef void (CL_CALLBACK * acEventFree_fn)(
cl_agent * /* agent */,
cl_event /* event */);
typedef void(CL_CALLBACK* acEventFree_fn)(cl_agent* /* agent */, cl_event /* event */);
typedef void (CL_CALLBACK * acEventStatusChanged_fn)(
cl_agent * /* agent */,
cl_event /* event */,
cl_int /* execution_status */,
cl_long /* epoch_time_stamp */);
typedef void(CL_CALLBACK* acEventStatusChanged_fn)(cl_agent* /* agent */, cl_event /* event */,
cl_int /* execution_status */,
cl_long /* epoch_time_stamp */);
/* Memory Object Callbacks */
typedef void (CL_CALLBACK * acMemObjectCreate_fn)(
cl_agent * /* agent */,
cl_mem /* memobj */);
typedef void(CL_CALLBACK* acMemObjectCreate_fn)(cl_agent* /* agent */, cl_mem /* memobj */);
typedef void (CL_CALLBACK * acMemObjectFree_fn)(
cl_agent * /* agent */,
cl_mem /* memobj */);
typedef void(CL_CALLBACK* acMemObjectFree_fn)(cl_agent* /* agent */, cl_mem /* memobj */);
typedef void (CL_CALLBACK * acMemObjectAcquired_fn)(
cl_agent * /* agent */,
cl_mem /* memobj */,
cl_device_id /* device */,
cl_long /* elapsed_time */);
typedef void(CL_CALLBACK* acMemObjectAcquired_fn)(cl_agent* /* agent */, cl_mem /* memobj */,
cl_device_id /* device */,
cl_long /* elapsed_time */);
/* Sampler Callbacks */
typedef void (CL_CALLBACK * acSamplerCreate_fn)(
cl_agent * /* agent */,
cl_sampler /* sampler */);
typedef void(CL_CALLBACK* acSamplerCreate_fn)(cl_agent* /* agent */, cl_sampler /* sampler */);
typedef void (CL_CALLBACK * acSamplerFree_fn)(
cl_agent * /* agent */,
cl_sampler /* sampler */);
typedef void(CL_CALLBACK* acSamplerFree_fn)(cl_agent* /* agent */, cl_sampler /* sampler */);
/* Program Callbacks */
typedef void (CL_CALLBACK * acProgramCreate_fn)(
cl_agent * /* agent */,
cl_program /* program */);
typedef void(CL_CALLBACK* acProgramCreate_fn)(cl_agent* /* agent */, cl_program /* program */);
typedef void (CL_CALLBACK * acProgramFree_fn)(
cl_agent * /* agent */,
cl_program /* program */);
typedef void(CL_CALLBACK* acProgramFree_fn)(cl_agent* /* agent */, cl_program /* program */);
typedef void (CL_CALLBACK * acProgramBuild_fn)(
cl_agent * /* agent */,
cl_program /* program */);
typedef void(CL_CALLBACK* acProgramBuild_fn)(cl_agent* /* agent */, cl_program /* program */);
/* Kernel Callbacks */
typedef void (CL_CALLBACK * acKernelCreate_fn)(
cl_agent * /* agent */,
cl_kernel /* kernel */);
typedef void(CL_CALLBACK* acKernelCreate_fn)(cl_agent* /* agent */, cl_kernel /* kernel */);
typedef void (CL_CALLBACK * acKernelFree_fn)(
cl_agent * /* agent */,
cl_kernel /* kernel */);
typedef void(CL_CALLBACK* acKernelFree_fn)(cl_agent* /* agent */, cl_kernel /* kernel */);
typedef void (CL_CALLBACK * acKernelSetArg_fn)(
cl_agent * /* agent */,
cl_kernel /* kernel */,
cl_int /* arg_index */,
size_t /* size */,
const void * /* value_ptr */);
typedef void(CL_CALLBACK* acKernelSetArg_fn)(cl_agent* /* agent */, cl_kernel /* kernel */,
cl_int /* arg_index */, size_t /* size */,
const void* /* value_ptr */);
typedef struct _cl_agent_callbacks
{
/* Context Callbacks */
acContextCreate_fn ContextCreate;
acContextFree_fn ContextFree;
typedef struct _cl_agent_callbacks {
/* Context Callbacks */
acContextCreate_fn ContextCreate;
acContextFree_fn ContextFree;
/* Command Queue Callbacks */
acCommandQueueCreate_fn CommandQueueCreate;
acCommandQueueFree_fn CommandQueueFree;
/* Command Queue Callbacks */
acCommandQueueCreate_fn CommandQueueCreate;
acCommandQueueFree_fn CommandQueueFree;
/* Event Callbacks */
acEventCreate_fn EventCreate;
acEventFree_fn EventFree;
acEventStatusChanged_fn EventStatusChanged;
/* Event Callbacks */
acEventCreate_fn EventCreate;
acEventFree_fn EventFree;
acEventStatusChanged_fn EventStatusChanged;
/* Memory Object Callbacks */
acMemObjectCreate_fn MemObjectCreate;
acMemObjectFree_fn MemObjectFree;
acMemObjectAcquired_fn MemObjectAcquired;
/* Memory Object Callbacks */
acMemObjectCreate_fn MemObjectCreate;
acMemObjectFree_fn MemObjectFree;
acMemObjectAcquired_fn MemObjectAcquired;
/* Sampler Callbacks */
acSamplerCreate_fn SamplerCreate;
acSamplerFree_fn SamplerFree;
/* Sampler Callbacks */
acSamplerCreate_fn SamplerCreate;
acSamplerFree_fn SamplerFree;
/* Program Callbacks */
acProgramCreate_fn ProgramCreate;
acProgramFree_fn ProgramFree;
acProgramBuild_fn ProgramBuild;
/* Program Callbacks */
acProgramCreate_fn ProgramCreate;
acProgramFree_fn ProgramFree;
acProgramBuild_fn ProgramBuild;
/* Kernel Callbacks */
acKernelCreate_fn KernelCreate;
acKernelFree_fn KernelFree;
acKernelSetArg_fn KernelSetArg;
/* Kernel Callbacks */
acKernelCreate_fn KernelCreate;
acKernelFree_fn KernelFree;
acKernelSetArg_fn KernelSetArg;
} cl_agent_callbacks;
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
typedef struct _cl_agent_capabilities
{
cl_bitfield canGenerateContextEvents : 1;
cl_bitfield canGenerateCommandQueueEvents : 1;
cl_bitfield canGenerateEventEvents : 1;
cl_bitfield canGenerateMemObjectEvents : 1;
cl_bitfield canGenerateSamplerEvents : 1;
cl_bitfield canGenerateProgramEvents : 1;
cl_bitfield canGenerateKernelEvents : 1;
typedef struct _cl_agent_capabilities {
cl_bitfield canGenerateContextEvents : 1;
cl_bitfield canGenerateCommandQueueEvents : 1;
cl_bitfield canGenerateEventEvents : 1;
cl_bitfield canGenerateMemObjectEvents : 1;
cl_bitfield canGenerateSamplerEvents : 1;
cl_bitfield canGenerateProgramEvents : 1;
cl_bitfield canGenerateKernelEvents : 1;
} cl_agent_capabilities;
struct _cl_agent
{
cl_int (CL_API_CALL * GetVersionNumber)(
cl_agent * /* agent */,
cl_int * /* version_ret */);
struct _cl_agent {
cl_int(CL_API_CALL* GetVersionNumber)(cl_agent* /* agent */, cl_int* /* version_ret */);
cl_int (CL_API_CALL * GetPlatform)(
cl_agent * /* agent */,
cl_platform_id * /* platform_id_ret */);
cl_int(CL_API_CALL* GetPlatform)(cl_agent* /* agent */, cl_platform_id* /* platform_id_ret */);
cl_int (CL_API_CALL * GetTime) (
cl_agent * /* agent */,
cl_long * /* time_nanos */);
cl_int(CL_API_CALL* GetTime)(cl_agent* /* agent */, cl_long* /* time_nanos */);
cl_int (CL_API_CALL * SetCallbacks)(
cl_agent * /* agent */,
const cl_agent_callbacks * /* callbacks */,
size_t /* size */);
cl_int(CL_API_CALL* SetCallbacks)(cl_agent* /* agent */,
const cl_agent_callbacks* /* callbacks */, size_t /* size */);
cl_int (CL_API_CALL * GetPotentialCapabilities)(
cl_agent * /* agent */,
cl_agent_capabilities * /* capabilities */);
cl_int(CL_API_CALL* GetPotentialCapabilities)(cl_agent* /* agent */,
cl_agent_capabilities* /* capabilities */);
cl_int (CL_API_CALL * GetCapabilities)(
cl_agent * /* agent */,
cl_agent_capabilities * /* capabilities */);
cl_int(CL_API_CALL* GetCapabilities)(cl_agent* /* agent */,
cl_agent_capabilities* /* capabilities */);
cl_int (CL_API_CALL * SetCapabilities)(
cl_agent * /* agent */,
const cl_agent_capabilities * /* capabilities */,
cl_agent_capability_action /* action */);
cl_int(CL_API_CALL* SetCapabilities)(cl_agent* /* agent */,
const cl_agent_capabilities* /* capabilities */,
cl_agent_capability_action /* action */);
cl_int (CL_API_CALL * GetICDDispatchTable)(
cl_agent * /* agent */,
cl_icd_dispatch_table * /* table */,
size_t /* size */);
cl_int(CL_API_CALL* GetICDDispatchTable)(cl_agent* /* agent */,
cl_icd_dispatch_table* /* table */, size_t /* size */);
cl_int (CL_API_CALL * SetICDDispatchTable)(
cl_agent * /* agent */,
const cl_icd_dispatch_table * /* table */,
size_t /* size */);
cl_int(CL_API_CALL* SetICDDispatchTable)(cl_agent* /* agent */,
const cl_icd_dispatch_table* /* table */,
size_t /* size */);
/* add Kernel/Program helper functions, etc... */
/* add Kernel/Program helper functions, etc... */
};
extern cl_int CL_CALLBACK
clAgent_OnLoad(cl_agent * /* agent */);
extern cl_int CL_CALLBACK clAgent_OnLoad(cl_agent* /* agent */);
extern void CL_CALLBACK
clAgent_OnUnload(cl_agent * /* agent */);
extern void CL_CALLBACK clAgent_OnUnload(cl_agent* /* agent */);
#ifdef __cplusplus
}
+157 -187
Wyświetl plik
@@ -54,132 +54,122 @@
*
* \version 1.0r33
*/
RUNTIME_ENTRY_RET(cl_command_queue, clCreateCommandQueueWithProperties, (
cl_context context,
cl_device_id device,
const cl_queue_properties *queue_properties,
cl_int *errcode_ret))
{
if (!is_valid(context)) {
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
return (cl_command_queue) 0;
}
RUNTIME_ENTRY_RET(cl_command_queue, clCreateCommandQueueWithProperties,
(cl_context context, cl_device_id device,
const cl_queue_properties* queue_properties, cl_int* errcode_ret)) {
if (!is_valid(context)) {
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
return (cl_command_queue)0;
}
amd::Context& amdContext = *as_amd(context);
amd::Device& amdDevice = *as_amd(device);
amd::Context& amdContext = *as_amd(context);
amd::Device& amdDevice = *as_amd(device);
if (!is_valid(device) ||
!amdContext.containsDevice(&amdDevice)) {
*not_null(errcode_ret) = CL_INVALID_DEVICE;
return (cl_command_queue) 0;
}
if (!is_valid(device) || !amdContext.containsDevice(&amdDevice)) {
*not_null(errcode_ret) = CL_INVALID_DEVICE;
return (cl_command_queue)0;
}
cl_command_queue_properties properties = 0;
const struct QueueProperty {
cl_queue_properties name;
union {
cl_queue_properties raw;
//FIXME_lmoriche: Check with Khronos. cl_queue_properties is an intptr,
//but cl_command_queue_properties is a bitfield (truncate?).
//cl_command_queue_properties properties;
cl_uint size;
} value;
} *p = reinterpret_cast<const QueueProperty*>(queue_properties);
cl_command_queue_properties properties = 0;
const struct QueueProperty {
cl_queue_properties name;
union {
cl_queue_properties raw;
// FIXME_lmoriche: Check with Khronos. cl_queue_properties is an intptr,
// but cl_command_queue_properties is a bitfield (truncate?).
// cl_command_queue_properties properties;
cl_uint size;
} value;
}* p = reinterpret_cast<const QueueProperty*>(queue_properties);
uint queueSize = amdDevice.info().queueOnDevicePreferredSize_;
uint queueRTCUs = amd::CommandQueue::RealTimeDisabled;
amd::CommandQueue::Priority priority = amd::CommandQueue::Priority::Normal;
if (p != NULL) while(p->name != 0) {
switch(p->name) {
uint queueSize = amdDevice.info().queueOnDevicePreferredSize_;
uint queueRTCUs = amd::CommandQueue::RealTimeDisabled;
amd::CommandQueue::Priority priority = amd::CommandQueue::Priority::Normal;
if (p != NULL)
while (p->name != 0) {
switch (p->name) {
case CL_QUEUE_PROPERTIES:
//FIXME_lmoriche: See comment above.
//properties = p->value.properties;
properties = static_cast<cl_command_queue_properties>(p->value.raw);
break;
// FIXME_lmoriche: See comment above.
// properties = p->value.properties;
properties = static_cast<cl_command_queue_properties>(p->value.raw);
break;
case CL_QUEUE_SIZE:
queueSize = p->value.size;
break;
#define CL_QUEUE_REAL_TIME_COMPUTE_UNITS_AMD 0x404f
queueSize = p->value.size;
break;
#define CL_QUEUE_REAL_TIME_COMPUTE_UNITS_AMD 0x404f
case CL_QUEUE_REAL_TIME_COMPUTE_UNITS_AMD:
queueRTCUs = p->value.size;
break;
#define CL_QUEUE_MEDIUM_PRIORITY_AMD 0x4050
queueRTCUs = p->value.size;
break;
#define CL_QUEUE_MEDIUM_PRIORITY_AMD 0x4050
case CL_QUEUE_MEDIUM_PRIORITY_AMD:
priority = amd::CommandQueue::Priority::Medium;
break;
priority = amd::CommandQueue::Priority::Medium;
break;
default:
*not_null(errcode_ret) = CL_INVALID_QUEUE_PROPERTIES;
LogWarning("invalid property name");
return (cl_command_queue) 0;
*not_null(errcode_ret) = CL_INVALID_QUEUE_PROPERTIES;
LogWarning("invalid property name");
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_) {
*not_null(errcode_ret) = CL_INVALID_VALUE;
return (cl_command_queue) 0;
if (queue == NULL || !queue->create()) {
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
delete queue;
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;
}
if (amd::Agent::shouldPostCommandQueueEvents()) {
amd::Agent::postCommandQueueCreate(as_cl(queue->asCommandQueue()));
}
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);
}
}
// 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);
*not_null(errcode_ret) = CL_SUCCESS;
return as_cl(queue);
}
RUNTIME_EXIT
RUNTIME_ENTRY_RET(cl_command_queue, clCreateCommandQueue, (
cl_context context,
cl_device_id device,
cl_command_queue_properties properties,
cl_int *errcode_ret))
{
const cl_queue_properties cprops[] = {
CL_QUEUE_PROPERTIES,
static_cast<cl_queue_properties>(properties),
0 };
return clCreateCommandQueueWithProperties(
context, device, properties ? cprops : NULL, errcode_ret);
RUNTIME_ENTRY_RET(cl_command_queue, clCreateCommandQueue,
(cl_context context, cl_device_id device, cl_command_queue_properties properties,
cl_int* errcode_ret)) {
const cl_queue_properties cprops[] = {CL_QUEUE_PROPERTIES,
static_cast<cl_queue_properties>(properties), 0};
return clCreateCommandQueueWithProperties(context, device, properties ? cprops : NULL,
errcode_ret);
}
RUNTIME_EXIT
@@ -199,13 +189,12 @@ RUNTIME_EXIT
*
* \version 1.0r33
*/
RUNTIME_ENTRY(cl_int, clRetainCommandQueue, (cl_command_queue command_queue))
{
if (!is_valid(command_queue)) {
return CL_INVALID_COMMAND_QUEUE;
}
as_amd(command_queue)->retain();
return CL_SUCCESS;
RUNTIME_ENTRY(cl_int, clRetainCommandQueue, (cl_command_queue command_queue)) {
if (!is_valid(command_queue)) {
return CL_INVALID_COMMAND_QUEUE;
}
as_amd(command_queue)->retain();
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -222,13 +211,12 @@ RUNTIME_EXIT
*
* \version 1.0r33
*/
RUNTIME_ENTRY(cl_int, clReleaseCommandQueue, (cl_command_queue command_queue))
{
if (!is_valid(command_queue)) {
return CL_INVALID_COMMAND_QUEUE;
}
as_amd(command_queue)->release();
return CL_SUCCESS;
RUNTIME_ENTRY(cl_int, clReleaseCommandQueue, (cl_command_queue command_queue)) {
if (!is_valid(command_queue)) {
return CL_INVALID_COMMAND_QUEUE;
}
as_amd(command_queue)->release();
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -259,64 +247,51 @@ RUNTIME_EXIT
*
* \version 1.0r33
*/
RUNTIME_ENTRY(cl_int, clGetCommandQueueInfo, (
cl_command_queue command_queue,
cl_command_queue_info param_name,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret))
{
if (!is_valid(command_queue)) {
return CL_INVALID_COMMAND_QUEUE;
}
RUNTIME_ENTRY(cl_int, clGetCommandQueueInfo,
(cl_command_queue command_queue, cl_command_queue_info param_name,
size_t param_value_size, void* param_value, 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: {
cl_context context = const_cast<cl_context>(
as_cl(&as_amd(command_queue)->context()));
return amd::clGetInfo(
context, param_value_size, param_value, param_value_size_ret);
cl_context context = const_cast<cl_context>(as_cl(&as_amd(command_queue)->context()));
return amd::clGetInfo(context, param_value_size, param_value, param_value_size_ret);
}
case CL_QUEUE_DEVICE: {
cl_device_id device = const_cast<cl_device_id>(
as_cl(&as_amd(command_queue)->device()));
return amd::clGetInfo(
device, param_value_size, param_value, param_value_size_ret);
cl_device_id device = const_cast<cl_device_id>(as_cl(&as_amd(command_queue)->device()));
return amd::clGetInfo(device, param_value_size, param_value, param_value_size_ret);
}
case CL_QUEUE_PROPERTIES: {
cl_command_queue_properties properties
= as_amd(command_queue)->properties().value_;
return amd::clGetInfo(
properties, param_value_size, param_value, param_value_size_ret);
cl_command_queue_properties properties = as_amd(command_queue)->properties().value_;
return amd::clGetInfo(properties, param_value_size, param_value, param_value_size_ret);
}
case CL_QUEUE_REFERENCE_COUNT: {
cl_uint count = as_amd(command_queue)->referenceCount();
return amd::clGetInfo(
count, param_value_size, param_value, param_value_size_ret);
cl_uint count = as_amd(command_queue)->referenceCount();
return amd::clGetInfo(count, param_value_size, param_value, param_value_size_ret);
}
case CL_QUEUE_SIZE: {
const amd::DeviceQueue* deviceQueue = as_amd(command_queue)->asDeviceQueue();
if (NULL == deviceQueue) {
return CL_INVALID_COMMAND_QUEUE;
}
cl_uint size = deviceQueue->size();
return amd::clGetInfo(
size, param_value_size, param_value, param_value_size_ret);
const amd::DeviceQueue* deviceQueue = as_amd(command_queue)->asDeviceQueue();
if (NULL == deviceQueue) {
return CL_INVALID_COMMAND_QUEUE;
}
cl_uint size = deviceQueue->size();
return amd::clGetInfo(size, param_value_size, param_value, param_value_size_ret);
}
case CL_QUEUE_THREAD_HANDLE_AMD: {
const amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
if (NULL == hostQueue) {
return CL_INVALID_COMMAND_QUEUE;
}
const void* handle = hostQueue->thread().handle();
return amd::clGetInfo(
handle, param_value_size, param_value, param_value_size_ret);
const amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
if (NULL == hostQueue) {
return CL_INVALID_COMMAND_QUEUE;
}
const void* handle = hostQueue->thread().handle();
return amd::clGetInfo(handle, param_value_size, param_value, param_value_size_ret);
}
default:
break;
}
break;
}
return CL_INVALID_VALUE;
return CL_INVALID_VALUE;
}
RUNTIME_EXIT
@@ -344,32 +319,27 @@ RUNTIME_EXIT
*
* \version 1.0r33
*/
RUNTIME_ENTRY(cl_int, clSetCommandQueueProperty, (
cl_command_queue command_queue,
cl_command_queue_properties properties,
cl_bool enable,
cl_command_queue_properties *old_properties))
{
if (!is_valid(command_queue)) {
return CL_INVALID_COMMAND_QUEUE;
}
RUNTIME_ENTRY(cl_int, clSetCommandQueueProperty,
(cl_command_queue command_queue, cl_command_queue_properties properties,
cl_bool enable, cl_command_queue_properties* old_properties)) {
if (!is_valid(command_queue)) {
return CL_INVALID_COMMAND_QUEUE;
}
*not_null(old_properties)
= as_amd(command_queue)->properties().value_;
*not_null(old_properties) = as_amd(command_queue)->properties().value_;
if (properties & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE) {
clFinish(command_queue);
}
if (properties & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE) {
clFinish(command_queue);
}
bool success;
if (enable == CL_TRUE) {
success = as_amd(command_queue)->properties().set(properties);
}
else {
success = as_amd(command_queue)->properties().clear(properties);
}
bool success;
if (enable == CL_TRUE) {
success = as_amd(command_queue)->properties().set(properties);
} else {
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
+324 -357
Wyświetl plik
@@ -15,7 +15,7 @@
#include "cl_d3d9_amd.hpp"
#include "cl_d3d10_amd.hpp"
#include "cl_d3d11_amd.hpp"
#endif // _WIN32
#endif // _WIN32
#include "cl_kernel_info_amd.h"
#include "cl_profile_amd.h"
#include "cl_platform_amd.h"
@@ -81,63 +81,56 @@
*
* \version 1.0r33
*/
RUNTIME_ENTRY_RET(cl_context, clCreateContext, (
const cl_context_properties *properties,
cl_uint num_devices,
const cl_device_id *devices,
void (CL_CALLBACK * pfn_notify)(
const char *,
const void *,
size_t,
void *),
void *user_data,
cl_int *errcode_ret))
{
cl_int errcode;
amd::Context::Info info;
RUNTIME_ENTRY_RET(cl_context, clCreateContext,
(const cl_context_properties* properties, cl_uint num_devices,
const cl_device_id* devices,
void(CL_CALLBACK* pfn_notify)(const char*, const void*, size_t, void*),
void* user_data, cl_int* errcode_ret)) {
cl_int errcode;
amd::Context::Info info;
errcode = amd::Context::checkProperties(properties, &info);
if (CL_SUCCESS != errcode) {
*not_null(errcode_ret) = errcode;
return (cl_context) 0;
errcode = amd::Context::checkProperties(properties, &info);
if (CL_SUCCESS != errcode) {
*not_null(errcode_ret) = errcode;
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) {
*not_null(errcode_ret) = CL_INVALID_VALUE;
return (cl_context) 0;
}
amd::Context* context = new amd::Context(devices_, info);
if (context == NULL) {
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
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 (CL_SUCCESS != (errcode = context->create(properties))) {
context->release();
*not_null(errcode_ret) = errcode;
return (cl_context)0;
}
if (!is_valid(device)) {
*not_null(errcode_ret) = CL_INVALID_DEVICE;
return (cl_context) 0;
}
devices_.push_back(as_amd(device));
}
if (amd::Agent::shouldPostContextEvents()) {
amd::Agent::postContextCreate(as_cl(context));
}
amd::Context* context = new amd::Context(devices_, info);
if (context == NULL) {
*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);
*not_null(errcode_ret) = CL_SUCCESS;
return as_cl(context);
}
RUNTIME_EXIT
@@ -168,49 +161,38 @@ RUNTIME_EXIT
*
* \version 1.0r33
*/
RUNTIME_ENTRY_RET(cl_context, clCreateContextFromType, (
const cl_context_properties *properties,
cl_device_type device_type,
void (CL_CALLBACK * pfn_notify)(
const char *,
const void *,
size_t,
void *),
void *user_data,
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;
}
RUNTIME_ENTRY_RET(cl_context, clCreateContextFromType,
(const cl_context_properties* properties, cl_device_type device_type,
void(CL_CALLBACK* pfn_notify)(const char*, const void*, size_t, void*),
void* user_data, 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.
cl_uint num_devices;
bool offlineDevices =
(info.flags_ & amd::Context::OfflineDevices) ? true : false;
if (!amd::Device::getDeviceIDs(device_type, 0, NULL,
&num_devices, offlineDevices)) {
*not_null(errcode_ret) = CL_DEVICE_NOT_FOUND;
return (cl_context) 0;
}
// Get the devices of the given type.
cl_uint num_devices;
bool offlineDevices = (info.flags_ & amd::Context::OfflineDevices) ? true : false;
if (!amd::Device::getDeviceIDs(device_type, 0, NULL, &num_devices, offlineDevices)) {
*not_null(errcode_ret) = CL_DEVICE_NOT_FOUND;
return (cl_context)0;
}
assert(num_devices > 0 && "Should have returned an error!");
cl_device_id* devices = (cl_device_id *)
alloca(num_devices * sizeof(cl_device_id));
assert(num_devices > 0 && "Should have returned an error!");
cl_device_id* devices = (cl_device_id*)alloca(num_devices * sizeof(cl_device_id));
if (!amd::Device::getDeviceIDs(device_type, num_devices,
devices, NULL, offlineDevices)) {
*not_null(errcode_ret) = CL_DEVICE_NOT_FOUND;
return (cl_context) 0;
}
if (!amd::Device::getDeviceIDs(device_type, num_devices, devices, NULL, offlineDevices)) {
*not_null(errcode_ret) = CL_DEVICE_NOT_FOUND;
return (cl_context)0;
}
// Create a new context with the devices
cl_context context = clCreateContext(
properties, num_devices, devices, pfn_notify, user_data, errcode_ret);
// Create a new context with the devices
cl_context context =
clCreateContext(properties, num_devices, devices, pfn_notify, user_data, errcode_ret);
return context;
return context;
}
RUNTIME_EXIT
@@ -230,13 +212,12 @@ RUNTIME_EXIT
*
* \version 1.0r33
*/
RUNTIME_ENTRY(cl_int, clRetainContext, (cl_context context))
{
if (!is_valid(context)) {
return CL_INVALID_CONTEXT;
}
as_amd(context)->retain();
return CL_SUCCESS;
RUNTIME_ENTRY(cl_int, clRetainContext, (cl_context context)) {
if (!is_valid(context)) {
return CL_INVALID_CONTEXT;
}
as_amd(context)->retain();
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -252,13 +233,12 @@ RUNTIME_EXIT
*
* \version 1.0r33
*/
RUNTIME_ENTRY(cl_int, clReleaseContext, (cl_context context))
{
if (!is_valid(context)) {
return CL_INVALID_CONTEXT;
}
as_amd(context)->release();
return CL_SUCCESS;
RUNTIME_ENTRY(cl_int, clReleaseContext, (cl_context context)) {
if (!is_valid(context)) {
return CL_INVALID_CONTEXT;
}
as_amd(context)->release();
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -288,165 +268,159 @@ RUNTIME_EXIT
*
* \version 1.0r33
*/
RUNTIME_ENTRY(cl_int, clGetContextInfo, (
cl_context context,
cl_context_info param_name,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret))
{
if (!is_valid(context)) {
return CL_INVALID_CONTEXT;
}
RUNTIME_ENTRY(cl_int, clGetContextInfo,
(cl_context context, cl_context_info param_name, size_t param_value_size,
void* param_value, 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: {
cl_uint count = as_amd(context)->referenceCount();
return amd::clGetInfo(
count, param_value_size, param_value, param_value_size_ret);
cl_uint count = as_amd(context)->referenceCount();
return amd::clGetInfo(count, param_value_size, param_value, param_value_size_ret);
}
case CL_CONTEXT_NUM_DEVICES: {
cl_uint numDevices = (cl_uint)as_amd(context)->devices().size();
return amd::clGetInfo(
numDevices, param_value_size, param_value, param_value_size_ret);
cl_uint numDevices = (cl_uint)as_amd(context)->devices().size();
return amd::clGetInfo(numDevices, param_value_size, param_value, param_value_size_ret);
}
case CL_CONTEXT_DEVICES: {
const std::vector<amd::Device*>& devices = as_amd(context)->devices();
size_t numDevices = devices.size();
size_t valueSize = numDevices * sizeof(cl_device_id*);
const std::vector<amd::Device*>& devices = as_amd(context)->devices();
size_t numDevices = devices.size();
size_t valueSize = numDevices * sizeof(cl_device_id*);
if (param_value != NULL && param_value_size < valueSize) {
return CL_INVALID_VALUE;
if (param_value != NULL && param_value_size < valueSize) {
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) {
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;
}
return CL_SUCCESS;
}
case CL_CONTEXT_PROPERTIES: {
const amd::Context* amdContext = as_amd(context);
size_t valueSize = amdContext->info().propertiesSize_;
const amd::Context* amdContext = as_amd(context);
size_t valueSize = amdContext->info().propertiesSize_;
if (param_value != NULL && param_value_size < valueSize) {
return CL_INVALID_VALUE;
}
*not_null(param_value_size_ret) = valueSize;
if ((param_value != NULL) && (valueSize != 0)) {
::memcpy(param_value, amdContext->properties(), valueSize);
}
return CL_SUCCESS;
if (param_value != NULL && param_value_size < valueSize) {
return CL_INVALID_VALUE;
}
*not_null(param_value_size_ret) = valueSize;
if ((param_value != NULL) && (valueSize != 0)) {
::memcpy(param_value, amdContext->properties(), valueSize);
}
return CL_SUCCESS;
}
#ifdef _WIN32
case CL_CONTEXT_D3D10_DEVICE_KHR: {
// Not defined in the ext.spec, but tested in the conf.test
// Guessing functionality from the test...
if (param_value != NULL && param_value_size < sizeof(void*)) {
return CL_INVALID_VALUE;
}
const amd::Context* amdContext = as_amd(context);
if (!(amdContext->info().flags_ & amd::Context::D3D10DeviceKhr)) {
return CL_INVALID_VALUE;
}
*not_null(param_value_size_ret) = sizeof(intptr_t);
if (param_value != NULL) {
*(intptr_t*) param_value =
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D10DeviceKhrIdx]);
}
return CL_SUCCESS;
// Not defined in the ext.spec, but tested in the conf.test
// Guessing functionality from the test...
if (param_value != NULL && param_value_size < sizeof(void*)) {
return CL_INVALID_VALUE;
}
const amd::Context* amdContext = as_amd(context);
if (!(amdContext->info().flags_ & amd::Context::D3D10DeviceKhr)) {
return CL_INVALID_VALUE;
}
*not_null(param_value_size_ret) = sizeof(intptr_t);
if (param_value != NULL) {
*(intptr_t*)param_value =
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D10DeviceKhrIdx]);
}
return CL_SUCCESS;
}
case CL_CONTEXT_D3D10_PREFER_SHARED_RESOURCES_KHR: {
if (param_value != NULL && param_value_size < sizeof(cl_bool)) {
return CL_INVALID_VALUE;
}
*not_null(param_value_size_ret) = sizeof(cl_bool);
if (param_value != NULL) {
*(cl_bool*) param_value = CL_TRUE;
}
return CL_SUCCESS;
if (param_value != NULL && param_value_size < sizeof(cl_bool)) {
return CL_INVALID_VALUE;
}
*not_null(param_value_size_ret) = sizeof(cl_bool);
if (param_value != NULL) {
*(cl_bool*)param_value = CL_TRUE;
}
return CL_SUCCESS;
}
case CL_CONTEXT_D3D11_DEVICE_KHR: {
// Not defined in the ext.spec, but tested in the conf.test
// Guessing functionality from the test...
if (param_value != NULL && param_value_size < sizeof(void*)) {
return CL_INVALID_VALUE;
}
const amd::Context* amdContext = as_amd(context);
if (!(amdContext->info().flags_ & amd::Context::D3D11DeviceKhr)) {
return CL_INVALID_VALUE;
}
*not_null(param_value_size_ret) = sizeof(intptr_t);
if (param_value != NULL) {
*(intptr_t*) param_value =
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D11DeviceKhrIdx]);
}
return CL_SUCCESS;
// Not defined in the ext.spec, but tested in the conf.test
// Guessing functionality from the test...
if (param_value != NULL && param_value_size < sizeof(void*)) {
return CL_INVALID_VALUE;
}
const amd::Context* amdContext = as_amd(context);
if (!(amdContext->info().flags_ & amd::Context::D3D11DeviceKhr)) {
return CL_INVALID_VALUE;
}
*not_null(param_value_size_ret) = sizeof(intptr_t);
if (param_value != NULL) {
*(intptr_t*)param_value =
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D11DeviceKhrIdx]);
}
return CL_SUCCESS;
}
case CL_CONTEXT_D3D11_PREFER_SHARED_RESOURCES_KHR: {
if (param_value != NULL && param_value_size < sizeof(cl_bool)) {
return CL_INVALID_VALUE;
}
*not_null(param_value_size_ret) = sizeof(cl_bool);
if (param_value != NULL) {
*(cl_bool*) param_value = CL_TRUE;
}
return CL_SUCCESS;
if (param_value != NULL && param_value_size < sizeof(cl_bool)) {
return CL_INVALID_VALUE;
}
*not_null(param_value_size_ret) = sizeof(cl_bool);
if (param_value != NULL) {
*(cl_bool*)param_value = CL_TRUE;
}
return CL_SUCCESS;
}
case CL_CONTEXT_ADAPTER_D3D9_KHR: {
if (param_value != NULL && param_value_size < sizeof(void*)) {
return CL_INVALID_VALUE;
}
const amd::Context* amdContext = as_amd(context);
if (!(amdContext->info().flags_ & amd::Context::D3D9DeviceKhr)) {
return CL_INVALID_VALUE;
}
*not_null(param_value_size_ret) = sizeof(intptr_t);
if (param_value != NULL) {
*(intptr_t*) param_value =
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D9DeviceKhrIdx]);
}
return CL_SUCCESS;
if (param_value != NULL && param_value_size < sizeof(void*)) {
return CL_INVALID_VALUE;
}
const amd::Context* amdContext = as_amd(context);
if (!(amdContext->info().flags_ & amd::Context::D3D9DeviceKhr)) {
return CL_INVALID_VALUE;
}
*not_null(param_value_size_ret) = sizeof(intptr_t);
if (param_value != NULL) {
*(intptr_t*)param_value =
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D9DeviceKhrIdx]);
}
return CL_SUCCESS;
}
case CL_CONTEXT_ADAPTER_D3D9EX_KHR: {
if (param_value != NULL && param_value_size < sizeof(void*)) {
return CL_INVALID_VALUE;
}
const amd::Context* amdContext = as_amd(context);
if (!(amdContext->info().flags_ & amd::Context::D3D9DeviceEXKhr)) {
return CL_INVALID_VALUE;
}
*not_null(param_value_size_ret) = sizeof(intptr_t);
if (param_value != NULL) {
*(intptr_t*) param_value =
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D9DeviceEXKhrIdx]);
}
return CL_SUCCESS;
if (param_value != NULL && param_value_size < sizeof(void*)) {
return CL_INVALID_VALUE;
}
const amd::Context* amdContext = as_amd(context);
if (!(amdContext->info().flags_ & amd::Context::D3D9DeviceEXKhr)) {
return CL_INVALID_VALUE;
}
*not_null(param_value_size_ret) = sizeof(intptr_t);
if (param_value != NULL) {
*(intptr_t*)param_value =
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D9DeviceEXKhrIdx]);
}
return CL_SUCCESS;
}
case CL_CONTEXT_ADAPTER_DXVA_KHR: {
if (param_value != NULL && param_value_size < sizeof(void*)) {
return CL_INVALID_VALUE;
}
const amd::Context* amdContext = as_amd(context);
if (!(amdContext->info().flags_ & amd::Context::D3D9DeviceVAKhr)) {
return CL_INVALID_VALUE;
}
*not_null(param_value_size_ret) = sizeof(intptr_t);
if (param_value != NULL) {
*(intptr_t*) param_value =
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D9DeviceVAKhrIdx]);
}
return CL_SUCCESS;
if (param_value != NULL && param_value_size < sizeof(void*)) {
return CL_INVALID_VALUE;
}
const amd::Context* amdContext = as_amd(context);
if (!(amdContext->info().flags_ & amd::Context::D3D9DeviceVAKhr)) {
return CL_INVALID_VALUE;
}
*not_null(param_value_size_ret) = sizeof(intptr_t);
if (param_value != NULL) {
*(intptr_t*)param_value =
reinterpret_cast<intptr_t>(amdContext->info().hDev_[amd::Context::D3D9DeviceVAKhrIdx]);
}
return CL_SUCCESS;
}
#endif //_WIN32
#endif //_WIN32
default:
break;
}
break;
}
return CL_INVALID_VALUE;
return CL_INVALID_VALUE;
}
RUNTIME_EXIT
@@ -465,158 +439,151 @@ RUNTIME_EXIT
*
* \version 1.2r07
*/
CL_API_ENTRY void* CL_API_CALL clGetExtensionFunctionAddressForPlatform(
cl_platform_id platform,
const char *funcname)
{
if (platform != NULL && platform != AMD_PLATFORM) {
return NULL;
}
CL_API_ENTRY void* CL_API_CALL clGetExtensionFunctionAddressForPlatform(cl_platform_id platform,
const char* funcname) {
if (platform != NULL && platform != AMD_PLATFORM) {
return NULL;
}
return clGetExtensionFunctionAddress(funcname);
return clGetExtensionFunctionAddress(funcname);
}
CL_API_ENTRY void* CL_API_CALL
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_CHECK2(name1,name2) \
if (!strcmp(func_name, #name1)) return reinterpret_cast<void*>(name2);
CL_API_ENTRY void* CL_API_CALL 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_CHECK2(name1, name2) \
if (!strcmp(func_name, #name1)) return reinterpret_cast<void*>(name2);
switch (func_name[2]) {
switch (func_name[2]) {
case 'C':
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateEventFromGLsyncKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clCreatePerfCounterAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateThreadTraceAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromGLBuffer);
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromGLTexture2D);
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromGLTexture3D);
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromGLRenderbuffer);
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateEventFromGLsyncKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clCreatePerfCounterAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateThreadTraceAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromGLBuffer);
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromGLTexture2D);
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromGLTexture3D);
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromGLRenderbuffer);
#ifdef _WIN32
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromD3D10BufferKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromD3D10Texture2DKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromD3D10Texture3DKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromDX9MediaSurfaceKHR);
#endif //_WIN32
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromD3D10BufferKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromD3D10Texture2DKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromD3D10Texture3DKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateFromDX9MediaSurfaceKHR);
#endif //_WIN32
#ifdef cl_ext_device_fission
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateSubDevicesEXT);
#endif // cl_ext_device_fission
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateKeyAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clConvertImageAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateBufferFromImageAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateSubDevicesEXT);
#endif // cl_ext_device_fission
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateKeyAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clConvertImageAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateBufferFromImageAMD);
#if cl_khr_il_program
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateProgramWithILKHR);
#endif // cl_khr_il_program
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateProgramWithILKHR);
#endif // cl_khr_il_program
#if cl_amd_liquid_flash
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateSsgFileObjectAMD);
#endif // cl_amd_liquid_flash
break;
CL_EXTENSION_ENTRYPOINT_CHECK(clCreateSsgFileObjectAMD);
#endif // cl_amd_liquid_flash
break;
case 'D':
break;
break;
case 'E':
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueBeginPerfCounterAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueEndPerfCounterAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueAcquireGLObjects);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueReleaseGLObjects);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueBindThreadTraceBufferAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueThreadTraceCommandAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueBeginPerfCounterAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueEndPerfCounterAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueAcquireGLObjects);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueReleaseGLObjects);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueBindThreadTraceBufferAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueThreadTraceCommandAMD);
#ifdef _WIN32
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueAcquireD3D10ObjectsKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueReleaseD3D10ObjectsKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueAcquireDX9MediaSurfacesKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueReleaseDX9MediaSurfacesKHR);
#endif //_WIN32
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueWaitSignalAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueWriteSignalAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueMakeBuffersResidentAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueAcquireD3D10ObjectsKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueReleaseD3D10ObjectsKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueAcquireDX9MediaSurfacesKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueReleaseDX9MediaSurfacesKHR);
#endif //_WIN32
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueWaitSignalAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueWriteSignalAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueMakeBuffersResidentAMD);
#if cl_amd_liquid_flash
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueReadSsgFileAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueWriteSsgFileAMD);
#endif // cl_amd_liquid_flash
break;
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueReadSsgFileAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clEnqueueWriteSsgFileAMD);
#endif // cl_amd_liquid_flash
break;
case 'G':
CL_EXTENSION_ENTRYPOINT_CHECK(clGetKernelInfoAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clGetPerfCounterInfoAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clGetGLObjectInfo);
CL_EXTENSION_ENTRYPOINT_CHECK(clGetGLTextureInfo);
CL_EXTENSION_ENTRYPOINT_CHECK(clGetGLContextInfoKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clGetThreadTraceInfoAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clGetKernelInfoAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clGetPerfCounterInfoAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clGetGLObjectInfo);
CL_EXTENSION_ENTRYPOINT_CHECK(clGetGLTextureInfo);
CL_EXTENSION_ENTRYPOINT_CHECK(clGetGLContextInfoKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clGetThreadTraceInfoAMD);
#ifdef _WIN32
CL_EXTENSION_ENTRYPOINT_CHECK(clGetDeviceIDsFromD3D10KHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clGetDeviceIDsFromDX9MediaAdapterKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clGetPlaneFromImageAMD);
#endif //_WIN32
CL_EXTENSION_ENTRYPOINT_CHECK(clGetKernelSubGroupInfoKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clGetDeviceIDsFromD3D10KHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clGetDeviceIDsFromDX9MediaAdapterKHR);
CL_EXTENSION_ENTRYPOINT_CHECK(clGetPlaneFromImageAMD);
#endif //_WIN32
CL_EXTENSION_ENTRYPOINT_CHECK(clGetKernelSubGroupInfoKHR);
#if cl_amd_liquid_flash
CL_EXTENSION_ENTRYPOINT_CHECK(clGetSsgFileObjectInfoAMD);
#endif // cl_amd_liquid_flash
break;
CL_EXTENSION_ENTRYPOINT_CHECK(clGetSsgFileObjectInfoAMD);
#endif // cl_amd_liquid_flash
break;
case 'H':
#ifdef _WIN32
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetCallBackFunctionsAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetCallBackArgumentsAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgFlushCacheAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetExceptionPolicyAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgGetExceptionPolicyAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetKernelExecutionModeAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgGetKernelExecutionModeAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgCreateEventAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgWaitEventAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgDestroyEventAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgRegisterDebuggerAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgUnregisterDebuggerAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetAclBinaryAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgWaveControlAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgAddressWatchAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgGetAqlPacketInfoAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgGetDispatchDebugInfoAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgMapKernelCodeAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgUnmapKernelCodeAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgMapScratchRingAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgUnmapScratchRingAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgGetKernelParamMemAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetGlobalMemoryAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgInstallTrapAMD);
#endif //_WIN32
break;
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetCallBackFunctionsAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetCallBackArgumentsAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgFlushCacheAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetExceptionPolicyAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgGetExceptionPolicyAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetKernelExecutionModeAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgGetKernelExecutionModeAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgCreateEventAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgWaitEventAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgDestroyEventAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgRegisterDebuggerAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgUnregisterDebuggerAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetAclBinaryAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgWaveControlAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgAddressWatchAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgGetAqlPacketInfoAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgGetDispatchDebugInfoAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgMapKernelCodeAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgUnmapKernelCodeAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgMapScratchRingAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgUnmapScratchRingAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgGetKernelParamMemAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgSetGlobalMemoryAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clHwDbgInstallTrapAMD);
#endif //_WIN32
break;
case 'I':
CL_EXTENSION_ENTRYPOINT_CHECK(clIcdGetPlatformIDsKHR);
break;
CL_EXTENSION_ENTRYPOINT_CHECK(clIcdGetPlatformIDsKHR);
break;
case 'O':
CL_EXTENSION_ENTRYPOINT_CHECK(clObjectGetValueForKeyAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clObjectSetValueForKeyAMD);
break;
CL_EXTENSION_ENTRYPOINT_CHECK(clObjectGetValueForKeyAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clObjectSetValueForKeyAMD);
break;
case 'R':
CL_EXTENSION_ENTRYPOINT_CHECK(clReleasePerfCounterAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clRetainPerfCounterAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clReleaseThreadTraceAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clRetainThreadTraceAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clReleasePerfCounterAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clRetainPerfCounterAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clReleaseThreadTraceAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clRetainThreadTraceAMD);
#ifdef cl_ext_device_fission
CL_EXTENSION_ENTRYPOINT_CHECK(clRetainDeviceEXT);
CL_EXTENSION_ENTRYPOINT_CHECK(clReleaseDeviceEXT);
#endif // cl_ext_device_fission
CL_EXTENSION_ENTRYPOINT_CHECK(clRetainDeviceEXT);
CL_EXTENSION_ENTRYPOINT_CHECK(clReleaseDeviceEXT);
#endif // cl_ext_device_fission
#if cl_amd_liquid_flash
CL_EXTENSION_ENTRYPOINT_CHECK(clRetainSsgFileObjectAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clReleaseSsgFileObjectAMD);
#endif // cl_amd_liquid_flash
break;
CL_EXTENSION_ENTRYPOINT_CHECK(clRetainSsgFileObjectAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clReleaseSsgFileObjectAMD);
#endif // cl_amd_liquid_flash
break;
case 'S':
CL_EXTENSION_ENTRYPOINT_CHECK(clSetThreadTraceParamAMD);
break;
CL_EXTENSION_ENTRYPOINT_CHECK(clSetThreadTraceParamAMD);
break;
case 'U':
CL_EXTENSION_ENTRYPOINT_CHECK(clUnloadPlatformAMD);
CL_EXTENSION_ENTRYPOINT_CHECK(clUnloadPlatformAMD);
default:
break;
}
break;
}
return NULL;
return NULL;
}
RUNTIME_ENTRY(cl_int, clTerminateContextKHR, (cl_context context))
{
return CL_INVALID_CONTEXT;
}
RUNTIME_ENTRY(cl_int, clTerminateContextKHR, (cl_context context)) { return CL_INVALID_CONTEXT; }
RUNTIME_EXIT
+32 -51
Wyświetl plik
@@ -25,14 +25,11 @@
*
* \version 1.1r18
*/
RUNTIME_ENTRY_RET(cl_counter_amd, clCreateCounterAMD, (
cl_context context,
cl_counter_flags_amd flags,
cl_uint value,
cl_int * errcode_ret))
{
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
return (cl_counter_amd)0;
RUNTIME_ENTRY_RET(cl_counter_amd, clCreateCounterAMD,
(cl_context context, cl_counter_flags_amd flags, cl_uint value,
cl_int* errcode_ret)) {
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
return (cl_counter_amd)0;
}
RUNTIME_EXIT
@@ -40,14 +37,10 @@ RUNTIME_EXIT
*
* \version 1.1r18
*/
RUNTIME_ENTRY(cl_int, clGetCounterInfoAMD, (
cl_counter_amd counter,
cl_counter_info_amd param_name,
size_t param_value_size,
void * param_value,
size_t * param_value_size_ret))
{
return CL_INVALID_COUNTER_AMD;
RUNTIME_ENTRY(cl_int, clGetCounterInfoAMD,
(cl_counter_amd counter, cl_counter_info_amd param_name, size_t param_value_size,
void* param_value, size_t* param_value_size_ret)) {
return CL_INVALID_COUNTER_AMD;
}
RUNTIME_EXIT
@@ -60,13 +53,12 @@ RUNTIME_EXIT
*
* \version 1.1r18
*/
RUNTIME_ENTRY(cl_int, clRetainCounterAMD, (cl_counter_amd counter))
{
if (!is_valid(counter)) {
return CL_INVALID_COUNTER_AMD;
}
as_amd(counter)->retain();
return CL_SUCCESS;
RUNTIME_ENTRY(cl_int, clRetainCounterAMD, (cl_counter_amd counter)) {
if (!is_valid(counter)) {
return CL_INVALID_COUNTER_AMD;
}
as_amd(counter)->retain();
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -79,13 +71,12 @@ RUNTIME_EXIT
*
* \version 1.1r18
*/
RUNTIME_ENTRY(cl_int, clReleaseCounterAMD, (cl_counter_amd counter))
{
if (!is_valid(counter)) {
return CL_INVALID_COUNTER_AMD;
}
as_amd(counter)->release();
return CL_SUCCESS;
RUNTIME_ENTRY(cl_int, clReleaseCounterAMD, (cl_counter_amd counter)) {
if (!is_valid(counter)) {
return CL_INVALID_COUNTER_AMD;
}
as_amd(counter)->release();
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -93,16 +84,11 @@ RUNTIME_EXIT
*
* \version 1.1r18
*/
RUNTIME_ENTRY(cl_int, clEnqueueReadCounterAMD, (
cl_command_queue command_queue,
cl_counter_amd counter,
cl_bool blocking_read,
cl_uint * value,
cl_uint num_events_in_wait_list,
const cl_event * event_wait_list,
cl_event * event))
{
return CL_INVALID_COUNTER_AMD;
RUNTIME_ENTRY(cl_int, clEnqueueReadCounterAMD,
(cl_command_queue command_queue, cl_counter_amd counter, cl_bool blocking_read,
cl_uint* value, cl_uint num_events_in_wait_list, const cl_event* event_wait_list,
cl_event* event)) {
return CL_INVALID_COUNTER_AMD;
}
RUNTIME_EXIT
@@ -110,16 +96,11 @@ RUNTIME_EXIT
*
* \version 1.1r18
*/
RUNTIME_ENTRY(cl_int, clEnqueueWriteCounterAMD, (
cl_command_queue command_queue,
cl_counter_amd counter,
cl_bool blocking_write,
cl_uint value,
cl_uint num_events_in_wait_list,
const cl_event * event_wait_list,
cl_event * event))
{
return CL_INVALID_COUNTER_AMD;
RUNTIME_ENTRY(cl_int, clEnqueueWriteCounterAMD,
(cl_command_queue command_queue, cl_counter_amd counter, cl_bool blocking_write,
cl_uint value, cl_uint num_events_in_wait_list, const cl_event* event_wait_list,
cl_event* event)) {
return CL_INVALID_COUNTER_AMD;
}
RUNTIME_EXIT
@@ -127,4 +108,4 @@ RUNTIME_EXIT
* @}
*/
#endif // cl_amd_atomic_counters
#endif // cl_amd_atomic_counters
Plik diff jest za duży Load Diff
Plik diff jest za duży Load Diff
Plik diff jest za duży Load Diff
Plik diff jest za duży Load Diff
+173 -213
Wyświetl plik
@@ -106,22 +106,21 @@ jurisdiction and venue of these courts.
extern "C" {
#endif /*__cplusplus*/
#define CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD -80
#define CL_DEBUGGER_REGISTER_FAILURE_AMD -81
#define CL_TRAP_HANDLER_NOT_DEFINED_AMD -82
#define CL_EVENT_TIMEOUT_AMD -83
#define CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD -80
#define CL_DEBUGGER_REGISTER_FAILURE_AMD -81
#define CL_TRAP_HANDLER_NOT_DEFINED_AMD -82
#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
*
* The trap handler for each support type.
*/
enum cl_dbg_trap_type_amd
{
CL_DBG_DEBUG_TRAP = 0, //! HW debug
CL_DBG_MAX_TRAP
enum cl_dbg_trap_type_amd {
CL_DBG_DEBUG_TRAP = 0, //! HW debug
CL_DBG_MAX_TRAP
};
/*! \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
* five types of operations that can be specified.
*/
enum cl_dbg_waves_action_amd
{
CL_DBG_WAVES_DONT_USE_ZERO = 0, //! NOT USED
CL_DBG_WAVES_HALT = 1, //! halt wave
CL_DBG_WAVES_RESUME = 2, //! resume wave
CL_DBG_WAVES_KILL = 3, //! kill wave
CL_DBG_WAVES_DEBUG = 4, //! debug wave
CL_DBG_WAVES_TRAP = 5, //! trap
CL_DBG_WAVES_MAX
enum cl_dbg_waves_action_amd {
CL_DBG_WAVES_DONT_USE_ZERO = 0, //! NOT USED
CL_DBG_WAVES_HALT = 1, //! halt wave
CL_DBG_WAVES_RESUME = 2, //! resume wave
CL_DBG_WAVES_KILL = 3, //! kill wave
CL_DBG_WAVES_DEBUG = 4, //! debug wave
CL_DBG_WAVES_TRAP = 5, //! trap
CL_DBG_WAVES_MAX
};
/*! \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
* response in the event thatn a device kernel exception is encountered.
*/
enum cl_dbg_host_action_amd
{
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_NOTIFY = 4 //! report the kernel exception
enum cl_dbg_host_action_amd {
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_NOTIFY = 4 //! report the kernel exception
};
/*! \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
* broadcast level when calling the wave control function.
*/
enum cl_dbg_wave_mode_amd
{
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_CU = 3, //! send command to wave with match VMID with specific CU
CL_DBG_WAVEMODE_MAX
enum cl_dbg_wave_mode_amd {
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_CU = 3, //! send command to wave with match VMID with specific CU
CL_DBG_WAVEMODE_MAX
};
/*! \brief Enumeration of address watch mode
*
* This enumeration indicates the different modes of address watch.
*/
enum cl_dbg_address_watch_mode_amd
{
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_ATOMIC = 2, //! Atomic Operations only
CL_DBG_ADDR_WATCH_MODE_ALL = 3, //! Read, Write or Atomic operations
CL_DBG_ADDR_WATCH_MODE_MAX //! Number of address watch modes
enum cl_dbg_address_watch_mode_amd {
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_ATOMIC = 2, //! Atomic Operations only
CL_DBG_ADDR_WATCH_MODE_ALL = 3, //! Read, Write or Atomic operations
CL_DBG_ADDR_WATCH_MODE_MAX //! Number of address watch modes
};
/*! \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
* on the associated dispatch.
*/
typedef struct _cl_dbg_exception_policy_amd
{
cl_uint exceptionMask; //! exception mask
cl_dbg_waves_action_amd waveAction; //! wave action
cl_dbg_host_action_amd hostAction; //! host action
cl_dbg_wave_mode_amd waveMode; //! wave mode
typedef struct _cl_dbg_exception_policy_amd {
cl_uint exceptionMask; //! exception mask
cl_dbg_waves_action_amd waveAction; //! wave action
cl_dbg_host_action_amd hostAction; //! host action
cl_dbg_wave_mode_amd waveMode; //! wave mode
} cl_dbg_exception_policy_amd;
/*! \brief Kernel execution mode
@@ -205,83 +199,78 @@ typedef struct _cl_dbg_exception_policy_amd
* 5. Disable L2 cache (0: enable (default), 1: disable)
* 6. Num of CUs reserved for display (0 (default), 7: max)
*/
typedef struct _cl_dbg_kernel_exec_mode_amd
{
union {
struct {
cl_uint monitorMode : 1;
cl_uint gpuSingleStepMode : 1;
cl_uint disableL1Scalar : 1;
cl_uint disableL1Vector : 1;
cl_uint disableL2Cache : 1;
cl_uint reservedCuNum : 3;
cl_uint reserved : 24;
};
cl_uint ui32All;
typedef struct _cl_dbg_kernel_exec_mode_amd {
union {
struct {
cl_uint monitorMode : 1;
cl_uint gpuSingleStepMode : 1;
cl_uint disableL1Scalar : 1;
cl_uint disableL1Vector : 1;
cl_uint disableL2Cache : 1;
cl_uint reservedCuNum : 3;
cl_uint reserved : 24;
};
cl_uint ui32All;
};
} cl_dbg_kernel_exec_mode_amd;
/*! \brief GPU cache mask
*
* This structure is used to specify the GPU cache to be flushed/invalidated
*/
typedef struct _cl_dbg_gpu_cache_mask_amd
{
union {
struct {
cl_uint sqICache : 1; //! instruction cache
cl_uint sqKCache : 1; //! data cache
cl_uint tcL1 : 1; //! tcL1 cache
cl_uint tcL2 : 1; //! tcL2 cache
cl_uint reserved : 28;
};
cl_uint ui32All;
typedef struct _cl_dbg_gpu_cache_mask_amd {
union {
struct {
cl_uint sqICache : 1; //! instruction cache
cl_uint sqKCache : 1; //! data cache
cl_uint tcL1 : 1; //! tcL1 cache
cl_uint tcL2 : 1; //! tcL2 cache
cl_uint reserved : 28;
};
cl_uint ui32All;
};
} cl_dbg_gpu_cache_mask_amd;
/*! \brief Dispatch Debug Info
*
* This structure is used to store the scratch and global memory descriptors
*/
typedef struct _cl_dispatch_debug_info_amd
{
cl_uint scratchMemoryDescriptor[4]; //! Scratch memory descriptors
cl_uint globalMemoryDescriptor[4]; //! Global memory descriptors
typedef struct _cl_dispatch_debug_info_amd {
cl_uint scratchMemoryDescriptor[4]; //! Scratch memory descriptors
cl_uint globalMemoryDescriptor[4]; //! Global memory descriptors
} cl_dispatch_debug_info_amd;
/*! \brief AQL Packet Info
*
* This structure is used to store AQL packet informatin for kernel dispatch
*/
typedef struct _cl_aql_packet_info_amd
{
cl_uint trapReservedVgprIndex; //! VGPR index reserved for trap
//! value is -1 when kernel was not compiled
//! in debug mode.
cl_uint scratchBufferWaveOffset; //! scratch buffer wave offset
//! value is -1 when kernel was not compiled
//! in debug mode or scratch buffer is not enabled
void *pointerToIsaBuffer; //! Pointer to buffer containing ISA
size_t sizeOfIsaBuffer; //! Size of the ISA buffer
typedef struct _cl_aql_packet_info_amd {
cl_uint trapReservedVgprIndex; //! VGPR index reserved for trap
//! value is -1 when kernel was not compiled
//! in debug mode.
cl_uint scratchBufferWaveOffset; //! scratch buffer wave offset
//! value is -1 when kernel was not compiled
//! in debug mode or scratch buffer is not enabled
void* pointerToIsaBuffer; //! Pointer to buffer containing ISA
size_t sizeOfIsaBuffer; //! Size of the ISA buffer
cl_uint numberOfVgprs; //! Number of VGPRs used by the kernel
cl_uint numberOfSgprs; //! Number of SGPRs used by the kernel
size_t sizeOfStaticGroupMemory; //! Static local memory used by the kernel
cl_uint numberOfVgprs; //! Number of VGPRs used by the kernel
cl_uint numberOfSgprs; //! Number of SGPRs used by the kernel
size_t sizeOfStaticGroupMemory; //! Static local memory used by the kernel
} cl_aql_packet_info_amd;
/*! \brief Wave address
*
* This structure specifies the wave for the SQ control command
*/
typedef struct _cl_dbg_wave_addr_amd
{
cl_uint shaderEngine : 2; //! Shader engine
cl_uint shaderArray : 1; //! Shader array
cl_uint computeUnit : 4; //! Compute unit
cl_uint simd : 2; //! SIMD id
cl_uint wave : 4; //! Wave id
cl_uint vmid : 4; //! VMID
cl_uint reserved : 15;
typedef struct _cl_dbg_wave_addr_amd {
cl_uint shaderEngine : 2; //! Shader engine
cl_uint shaderArray : 1; //! Shader array
cl_uint computeUnit : 4; //! Compute unit
cl_uint simd : 2; //! SIMD id
cl_uint wave : 4; //! Wave id
cl_uint vmid : 4; //! VMID
cl_uint reserved : 15;
} 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
* the kernel launch. It is used by the debugger.
*/
typedef void * (*cl_PreDispatchCallBackFunctionAMD) ( cl_device_id device,
void *ocl_event_handle,
const void *aql_packet,
void *acl_binary,
void *user_args);
typedef void* (*cl_PreDispatchCallBackFunctionAMD)(cl_device_id device, void* ocl_event_handle,
const void* aql_packet, void* acl_binary,
void* user_args);
/*! \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
* the the kernel launch. It is used by the debugger.
*/
typedef void * (*cl_PostDispatchCallBackFunctionAMD) ( cl_device_id device,
cl_ulong event,
void *user_args);
typedef void* (*cl_PostDispatchCallBackFunctionAMD)(cl_device_id device, cl_ulong event,
void* user_args);
/*! \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
*/
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetCallBackFunctionsAMD(
cl_device_id /* device */,
cl_PreDispatchCallBackFunctionAMD /* preDispatchFunction */,
cl_PostDispatchCallBackFunctionAMD /* postDispatchFunction */
) CL_API_SUFFIX__VERSION_2_0;
cl_device_id /* device */, cl_PreDispatchCallBackFunctionAMD /* preDispatchFunction */,
cl_PostDispatchCallBackFunctionAMD /* postDispatchFunction */
) CL_API_SUFFIX__VERSION_2_0;
/*! \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_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
*/
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetCallBackArgumentsAMD(
cl_device_id /* device */,
void * /* preDispatchArgs */,
void * /* postDispatchArgs */
) CL_API_SUFFIX__VERSION_2_0;
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetCallBackArgumentsAMD(cl_device_id /* device */,
void* /* preDispatchArgs */,
void* /* postDispatchArgs */
) CL_API_SUFFIX__VERSION_2_0;
/*! \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_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
*/
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgFlushCacheAMD(
cl_device_id /* device */,
cl_dbg_gpu_cache_mask_amd /* mask */
) CL_API_SUFFIX__VERSION_2_0;
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgFlushCacheAMD(cl_device_id /* device */,
cl_dbg_gpu_cache_mask_amd /* mask */
) CL_API_SUFFIX__VERSION_2_0;
/*! \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
*/
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetExceptionPolicyAMD(
cl_device_id /* device */,
cl_dbg_exception_policy_amd * /* policy */
) CL_API_SUFFIX__VERSION_2_0;
cl_device_id /* device */, cl_dbg_exception_policy_amd* /* policy */
) CL_API_SUFFIX__VERSION_2_0;
/*! \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
*/
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgGetExceptionPolicyAMD(
cl_device_id /* device */,
cl_dbg_exception_policy_amd * /* policy */
) CL_API_SUFFIX__VERSION_2_0;
cl_device_id /* device */, cl_dbg_exception_policy_amd* /* policy */
) CL_API_SUFFIX__VERSION_2_0;
/*! \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
*/
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetKernelExecutionModeAMD(
cl_device_id /* device */,
cl_dbg_kernel_exec_mode_amd * /* mode */
) CL_API_SUFFIX__VERSION_2_0;
cl_device_id /* device */, cl_dbg_kernel_exec_mode_amd* /* mode */
) CL_API_SUFFIX__VERSION_2_0;
/*! \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
*/
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgGetKernelExecutionModeAMD(
cl_device_id /* device */,
cl_dbg_kernel_exec_mode_amd * /* mode */
) CL_API_SUFFIX__VERSION_2_0;
cl_device_id /* device */, cl_dbg_kernel_exec_mode_amd* /* mode */
) CL_API_SUFFIX__VERSION_2_0;
/*! \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_OUT_OF_RESOURCES if fails to create the event
*/
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgCreateEventAMD(
cl_device_id /* device */,
bool /* autoReset */,
cl_dbg_event_amd * /* pDebugEvent */,
cl_uint * /* pEventId */
) CL_API_SUFFIX__VERSION_2_0;
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgCreateEventAMD(cl_device_id /* device */,
bool /* autoReset */,
cl_dbg_event_amd* /* pDebugEvent */,
cl_uint* /* pEventId */
) CL_API_SUFFIX__VERSION_2_0;
/*! \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_EVENT_TIMEOUT_AMD if timeout occurs
*/
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgWaitEventAMD(
cl_device_id /* device */,
cl_dbg_event_amd /* pDebugEvent */,
cl_uint /* pEventId */,
cl_uint /* timeOut */
) CL_API_SUFFIX__VERSION_2_0;
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgWaitEventAMD(cl_device_id /* device */,
cl_dbg_event_amd /* pDebugEvent */,
cl_uint /* pEventId */,
cl_uint /* timeOut */
) CL_API_SUFFIX__VERSION_2_0;
/*! \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_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
*/
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgDestroyEventAMD(
cl_device_id /* device */,
cl_dbg_event_amd * /* pDebugEvent */,
cl_uint * /* pEventId */
) CL_API_SUFFIX__VERSION_2_0;
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgDestroyEventAMD(cl_device_id /* device */,
cl_dbg_event_amd* /* pDebugEvent */,
cl_uint* /* pEventId */
) CL_API_SUFFIX__VERSION_2_0;
/*! \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
*/
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgRegisterDebuggerAMD(
cl_context /* context */,
cl_device_id /* device */,
volatile void * /* pMessageStorage */
) CL_API_SUFFIX__VERSION_2_0;
cl_context /* context */, cl_device_id /* device */, volatile void* /* pMessageStorage */
) CL_API_SUFFIX__VERSION_2_0;
/*! \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_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
*/
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgUnregisterDebuggerAMD(
cl_device_id /* device */
) CL_API_SUFFIX__VERSION_2_0;
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgUnregisterDebuggerAMD(cl_device_id /* device */
) CL_API_SUFFIX__VERSION_2_0;
/*! \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_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
*/
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetAclBinaryAMD(
cl_device_id /* device */,
void * /* aclBinary */
) CL_API_SUFFIX__VERSION_2_0;
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetAclBinaryAMD(cl_device_id /* device */,
void* /* aclBinary */
) CL_API_SUFFIX__VERSION_2_0;
/*! \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_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
*/
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgWaveControlAMD(
cl_device_id /* device */,
cl_dbg_waves_action_amd /* action */,
cl_dbg_wave_mode_amd /* mode */,
cl_uint /* trapId */,
cl_dbg_wave_addr_amd /* waveAddress */
) CL_API_SUFFIX__VERSION_2_0;
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgWaveControlAMD(cl_device_id /* device */,
cl_dbg_waves_action_amd /* action */,
cl_dbg_wave_mode_amd /* mode */,
cl_uint /* trapId */,
cl_dbg_wave_addr_amd /* waveAddress */
) CL_API_SUFFIX__VERSION_2_0;
/*! \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
*/
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgAddressWatchAMD(
cl_device_id /* device */,
cl_uint /* numWatchPoints */,
cl_dbg_address_watch_mode_amd * /* watchMode */,
void ** /* watchAddress */,
cl_ulong * /* watchMask */,
cl_dbg_event_amd * /* watchEvent */
) CL_API_SUFFIX__VERSION_2_0;
cl_device_id /* device */, cl_uint /* numWatchPoints */,
cl_dbg_address_watch_mode_amd* /* watchMode */, void** /* watchAddress */,
cl_ulong* /* watchMask */, cl_dbg_event_amd* /* watchEvent */
) CL_API_SUFFIX__VERSION_2_0;
/*! \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
*/
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgGetAqlPacketInfoAMD(
cl_device_id /* device */,
const void * /* aqlCodeInfo */,
cl_aql_packet_info_amd * /* packetInfo */
) CL_API_SUFFIX__VERSION_2_0;
cl_device_id /* device */, const void* /* aqlCodeInfo */,
cl_aql_packet_info_amd* /* packetInfo */
) CL_API_SUFFIX__VERSION_2_0;
/*! \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
*/
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgGetDispatchDebugInfoAMD(
cl_device_id /* device */,
cl_dispatch_debug_info_amd * /* debugInfo */
) CL_API_SUFFIX__VERSION_2_0;
cl_device_id /* device */, cl_dispatch_debug_info_amd* /* debugInfo */
) CL_API_SUFFIX__VERSION_2_0;
/*! \brief Map the video memory for the kernel code to allow host access
*
* \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
*
@@ -664,10 +631,9 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgGetDispatchDebugInfoAMD(
* - CL_INVALID_DEVICE if the device is not valid
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
*/
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgMapKernelCodeAMD(
cl_device_id /* device */,
void * /* aqlCodeInfo */
) CL_API_SUFFIX__VERSION_2_0;
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgMapKernelCodeAMD(cl_device_id /* device */,
void* /* aqlCodeInfo */
) CL_API_SUFFIX__VERSION_2_0;
/*! \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_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
*/
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgUnmapKernelCodeAMD(
cl_device_id /* device */,
cl_ulong * /* aqlCodeAddress */
) CL_API_SUFFIX__VERSION_2_0;
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgUnmapKernelCodeAMD(cl_device_id /* device */,
cl_ulong* /* aqlCodeAddress */
) CL_API_SUFFIX__VERSION_2_0;
/*! \brief Map the shader scratch ring's video memory to allow CPU access
*
* \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
*
@@ -700,11 +666,10 @@ extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgUnmapKernelCodeAMD(
* - CL_INVALID_DEVICE if the device is not valid
* - CL_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
*/
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgMapScratchRingAMD(
cl_device_id /* device */,
cl_ulong * /* scratchRingAddr */,
cl_uint * /* scratchRingSize */
) CL_API_SUFFIX__VERSION_2_0;
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgMapScratchRingAMD(cl_device_id /* device */,
cl_ulong* /* scratchRingAddr */,
cl_uint* /* scratchRingSize */
) CL_API_SUFFIX__VERSION_2_0;
/*! \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_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
*/
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgUnmapScratchRingAMD(
cl_device_id /* device */,
cl_ulong * /* scratchRingAddr */
) CL_API_SUFFIX__VERSION_2_0;
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgUnmapScratchRingAMD(cl_device_id /* device */,
cl_ulong* /* scratchRingAddr */
) CL_API_SUFFIX__VERSION_2_0;
/*! \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_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(
cl_device_id /* devicepointer */,
cl_uint /* paramIdx */,
cl_mem * /* paramMem */
) CL_API_SUFFIX__VERSION_2_0;
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgGetKernelParamMemAMD(cl_device_id /* devicepointer */,
cl_uint /* paramIdx */,
cl_mem* /* paramMem */
) CL_API_SUFFIX__VERSION_2_0;
/*! \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_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
*/
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetGlobalMemoryAMD(
cl_device_id /* device */,
cl_mem /* memObject */,
cl_uint /* offset */,
void * /* srcMem */,
cl_uint /* size */
) CL_API_SUFFIX__VERSION_2_0;
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgSetGlobalMemoryAMD(cl_device_id /* device */,
cl_mem /* memObject */,
cl_uint /* offset */,
void* /* srcMem */,
cl_uint /* size */
) CL_API_SUFFIX__VERSION_2_0;
/*! \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_HWDBG_MANAGER_NOT_AVAILABLE_AMD if there is no HW DEBUG manager
*/
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgInstallTrapAMD(
cl_device_id /* device */,
cl_dbg_trap_type_amd /* trapType */,
cl_mem /* trapHandler */,
cl_mem /* trapBuffer */
) CL_API_SUFFIX__VERSION_2_0;
extern CL_API_ENTRY cl_int CL_API_CALL clHwDbgInstallTrapAMD(cl_device_id /* device */,
cl_dbg_trap_type_amd /* trapType */,
cl_mem /* trapHandler */,
cl_mem /* trapBuffer */
) CL_API_SUFFIX__VERSION_2_0;
#ifdef __cplusplus
} /*extern "C"*/
#endif /*__cplusplus*/
#endif /*__CL_DEBUGGER_AMD_H*/
#endif /*__CL_DEBUGGER_AMD_H*/
Plik diff jest za duży Load Diff
+108 -133
Wyświetl plik
@@ -62,45 +62,41 @@
*
* \version 1.0r33
*/
RUNTIME_ENTRY(cl_int, clWaitForEvents, (
cl_uint num_events,
const cl_event *event_list))
{
if (num_events == 0 || event_list == NULL) {
return CL_INVALID_VALUE;
RUNTIME_ENTRY(cl_int, clWaitForEvents, (cl_uint num_events, const cl_event* event_list)) {
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;
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;
}
// 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;
// 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;
bool allSucceeded = true;
while (num_events-- > 0) {
allSucceeded &= as_amd(*event_list++)->awaitCompletion();
// Flush the command queues associated with event1...eventN
amd::HostQueue* queue = as_amd(event)->command().queue();
if (queue != NULL && prevQueue != queue) {
queue->flush();
}
return allSucceeded ? CL_SUCCESS
: CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST;
prevQueue = queue;
}
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
@@ -134,52 +130,44 @@ RUNTIME_EXIT
*
* \version 1.0r33
*/
RUNTIME_ENTRY(cl_int, clGetEventInfo, (
cl_event event,
cl_event_info param_name,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret))
{
if (!is_valid(event)) {
return CL_INVALID_EVENT;
}
RUNTIME_ENTRY(cl_int, clGetEventInfo,
(cl_event event, cl_event_info param_name, size_t param_value_size, void* param_value,
size_t* param_value_size_ret)) {
if (!is_valid(event)) {
return CL_INVALID_EVENT;
}
switch(param_name) {
switch (param_name) {
case CL_EVENT_CONTEXT: {
amd::Context& amdCtx = const_cast<amd::Context&>(as_amd(event)->context());
cl_context context = as_cl(&amdCtx);
return amd::clGetInfo(
context, param_value_size, param_value, param_value_size_ret);
amd::Context& amdCtx = const_cast<amd::Context&>(as_amd(event)->context());
cl_context context = as_cl(&amdCtx);
return amd::clGetInfo(context, param_value_size, param_value, param_value_size_ret);
}
case CL_EVENT_COMMAND_QUEUE: {
amd::Command& command = as_amd(event)->command();
cl_command_queue queue = command.queue() == NULL
? NULL : const_cast<cl_command_queue>(as_cl(command.queue()->asCommandQueue()));
return amd::clGetInfo(
queue, param_value_size, param_value, param_value_size_ret);
amd::Command& command = as_amd(event)->command();
cl_command_queue queue = command.queue() == NULL
? NULL
: const_cast<cl_command_queue>(as_cl(command.queue()->asCommandQueue()));
return amd::clGetInfo(queue, param_value_size, param_value, param_value_size_ret);
}
case CL_EVENT_COMMAND_TYPE: {
cl_command_type type = as_amd(event)->command().type();
return amd::clGetInfo(
type, param_value_size, param_value, param_value_size_ret);
cl_command_type type = as_amd(event)->command().type();
return amd::clGetInfo(type, param_value_size, param_value, param_value_size_ret);
}
case CL_EVENT_COMMAND_EXECUTION_STATUS: {
as_amd(event)->notifyCmdQueue();
cl_int status = as_amd(event)->command().status();
return amd::clGetInfo(
status, param_value_size, param_value, param_value_size_ret);
as_amd(event)->notifyCmdQueue();
cl_int status = as_amd(event)->command().status();
return amd::clGetInfo(status, param_value_size, param_value, param_value_size_ret);
}
case CL_EVENT_REFERENCE_COUNT: {
cl_uint count = as_amd(event)->referenceCount();
return amd::clGetInfo(
count, param_value_size, param_value, param_value_size_ret);
cl_uint count = as_amd(event)->referenceCount();
return amd::clGetInfo(count, param_value_size, param_value, param_value_size_ret);
}
default:
break;
}
break;
}
return CL_INVALID_VALUE;
return CL_INVALID_VALUE;
}
RUNTIME_EXIT
@@ -192,13 +180,12 @@ RUNTIME_EXIT
*
* \version 1.0r33
*/
RUNTIME_ENTRY(cl_int, clRetainEvent, (cl_event event))
{
if (!is_valid(event)) {
return CL_INVALID_EVENT;
}
as_amd(event)->retain();
return CL_SUCCESS;
RUNTIME_ENTRY(cl_int, clRetainEvent, (cl_event event)) {
if (!is_valid(event)) {
return CL_INVALID_EVENT;
}
as_amd(event)->retain();
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -214,13 +201,12 @@ RUNTIME_EXIT
*
* \version 1.0r33
*/
RUNTIME_ENTRY(cl_int, clReleaseEvent, (cl_event event))
{
if (!is_valid(event)) {
return CL_INVALID_EVENT;
}
as_amd(event)->release();
return CL_SUCCESS;
RUNTIME_ENTRY(cl_int, clReleaseEvent, (cl_event event)) {
if (!is_valid(event)) {
return CL_INVALID_EVENT;
}
as_amd(event)->release();
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -240,24 +226,21 @@ RUNTIME_EXIT
*
* \version 1.1r15
*/
RUNTIME_ENTRY_RET(cl_event, clCreateUserEvent, (
cl_context context,
cl_int *errcode_ret))
{
if (!is_valid(context)) {
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
return (cl_event) 0;
}
RUNTIME_ENTRY_RET(cl_event, clCreateUserEvent, (cl_context context, cl_int* errcode_ret)) {
if (!is_valid(context)) {
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
return (cl_event)0;
}
amd::Event* event = new amd::UserEvent(*as_amd(context));
if (event == NULL) {
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
return (cl_event) 0;
}
amd::Event* event = new amd::UserEvent(*as_amd(context));
if (event == NULL) {
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
return (cl_event)0;
}
event->retain();
*not_null(errcode_ret) = CL_SUCCESS;
return as_cl(event);
event->retain();
*not_null(errcode_ret) = CL_SUCCESS;
return as_cl(event);
}
RUNTIME_EXIT
@@ -279,21 +262,18 @@ RUNTIME_EXIT
*
* \version 1.1r15
*/
RUNTIME_ENTRY(cl_int, clSetUserEventStatus, (
cl_event event,
cl_int execution_status))
{
if (!is_valid(event)) {
return CL_INVALID_EVENT;
}
if (execution_status > CL_COMPLETE) {
return CL_INVALID_VALUE;
}
RUNTIME_ENTRY(cl_int, clSetUserEventStatus, (cl_event event, cl_int execution_status)) {
if (!is_valid(event)) {
return CL_INVALID_EVENT;
}
if (execution_status > CL_COMPLETE) {
return CL_INVALID_VALUE;
}
if (!as_amd(event)->setStatus(execution_status)) {
return CL_INVALID_OPERATION;
}
return CL_SUCCESS;
if (!as_amd(event)->setStatus(execution_status)) {
return CL_INVALID_OPERATION;
}
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -362,35 +342,30 @@ RUNTIME_EXIT
*
* \version 1.1r15
*/
RUNTIME_ENTRY(cl_int, clSetEventCallback, (
cl_event event,
cl_int command_exec_callback_type,
void (CL_CALLBACK * pfn_notify)(
cl_event event, cl_int command_exec_status, void *user_data),
void* user_data))
{
if (!is_valid(event)) {
return CL_INVALID_EVENT;
}
RUNTIME_ENTRY(cl_int, clSetEventCallback,
(cl_event event, cl_int command_exec_callback_type,
void(CL_CALLBACK* pfn_notify)(cl_event event, cl_int command_exec_status,
void* user_data),
void* user_data)) {
if (!is_valid(event)) {
return CL_INVALID_EVENT;
}
if (pfn_notify == NULL
|| command_exec_callback_type < CL_COMPLETE
|| command_exec_callback_type > CL_QUEUED) {
return CL_INVALID_VALUE;
}
if (pfn_notify == NULL || command_exec_callback_type < CL_COMPLETE ||
command_exec_callback_type > CL_QUEUED) {
return CL_INVALID_VALUE;
}
if (!as_amd(event)->setCallback(
command_exec_callback_type, pfn_notify, user_data)) {
return CL_OUT_OF_HOST_MEMORY;
}
if (!as_amd(event)->setCallback(command_exec_callback_type, pfn_notify, user_data)) {
return CL_OUT_OF_HOST_MEMORY;
}
as_amd(event)->notifyCmdQueue();
as_amd(event)->notifyCmdQueue();
return CL_SUCCESS;
return CL_SUCCESS;
}
RUNTIME_EXIT
/*! @}
* @}
*/
+336 -380
Wyświetl plik
@@ -150,144 +150,134 @@
*
* \version 1.0r33
*/
RUNTIME_ENTRY(cl_int, clEnqueueNDRangeKernel, (
cl_command_queue command_queue,
cl_kernel kernel,
cl_uint work_dim,
const size_t *global_work_offset,
const size_t *global_work_size,
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;
RUNTIME_ENTRY(cl_int, clEnqueueNDRangeKernel,
(cl_command_queue command_queue, cl_kernel kernel, cl_uint work_dim,
const size_t* global_work_offset, const size_t* global_work_size,
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)) {
return CL_INVALID_COMMAND_QUEUE;
}
if (!is_valid(kernel)) {
return CL_INVALID_KERNEL;
}
if (!is_valid(command_queue)) {
return CL_INVALID_COMMAND_QUEUE;
}
if (!is_valid(kernel)) {
return CL_INVALID_KERNEL;
}
amd::HostQueue* queue = as_amd(command_queue)->asHostQueue();
if (NULL == queue) {
return CL_INVALID_COMMAND_QUEUE;
}
amd::HostQueue& hostQueue = *queue;
amd::HostQueue* queue = as_amd(command_queue)->asHostQueue();
if (NULL == queue) {
return CL_INVALID_COMMAND_QUEUE;
}
amd::HostQueue& hostQueue = *queue;
const amd::Kernel* amdKernel = as_amd(kernel);
if (&hostQueue.context() != &amdKernel->program().context()) {
return CL_INVALID_CONTEXT;
}
const amd::Kernel* amdKernel = as_amd(kernel);
if (&hostQueue.context() != &amdKernel->program().context()) {
return CL_INVALID_CONTEXT;
}
const amd::Device& device = hostQueue.device();
const device::Kernel* devKernel = amdKernel->getDeviceKernel(device);
if (devKernel == NULL) {
return CL_INVALID_PROGRAM_EXECUTABLE;
}
const amd::Device& device = hostQueue.device();
const device::Kernel* devKernel = amdKernel->getDeviceKernel(device);
if (devKernel == NULL) {
return CL_INVALID_PROGRAM_EXECUTABLE;
}
if (amdKernel->parameters().getSvmSystemPointersSupport() == FGS_YES &&
!(device.info().svmCapabilities_ & CL_DEVICE_SVM_FINE_GRAIN_SYSTEM)) {
// The user indicated that this kernel will access SVM system pointers,
// but the device does not support them.
return CL_INVALID_OPERATION;
}
if (amdKernel->parameters().getSvmSystemPointersSupport() == FGS_YES &&
!(device.info().svmCapabilities_ & CL_DEVICE_SVM_FINE_GRAIN_SYSTEM)) {
// The user indicated that this kernel will access SVM system pointers,
// but the device does not support them.
return CL_INVALID_OPERATION;
}
if (work_dim < 1 || work_dim > 3) {
return CL_INVALID_WORK_DIMENSION;
}
if (work_dim < 1 || work_dim > 3) {
return CL_INVALID_WORK_DIMENSION;
}
#if !defined(CL_VERSION_1_1)
if (global_work_offset != NULL) {
return CL_INVALID_GLOBAL_OFFSET;
}
#endif // CL_VERSION
if (global_work_size == NULL) {
return CL_INVALID_VALUE;
}
else {
// >32bits global work size is not supported.
for (cl_uint dim = 0; dim < work_dim; ++dim) {
if (global_work_size[dim] > static_cast<size_t>(0xffffffff)) {
return CL_INVALID_GLOBAL_WORK_SIZE;
}
}
if (global_work_offset != NULL) {
return CL_INVALID_GLOBAL_OFFSET;
}
#endif // CL_VERSION
if (global_work_size == NULL) {
return CL_INVALID_VALUE;
} else {
// >32bits global work size is not supported.
for (cl_uint dim = 0; dim < work_dim; ++dim) {
if (global_work_size[dim] > static_cast<size_t>(0xffffffff)) {
return CL_INVALID_GLOBAL_WORK_SIZE;
}
}
}
if (local_work_size == NULL) {
static size_t zeroes[3] = { 0, 0, 0 };
local_work_size = zeroes;
if (local_work_size == NULL) {
static size_t zeroes[3] = {0, 0, 0};
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 {
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];
}
if (numWorkItems > devKernel->workGroupInfo()->size_) {
return CL_INVALID_WORK_GROUP_SIZE;
}
if (numWorkItems > devKernel->workGroupInfo()->size_) {
return CL_INVALID_WORK_GROUP_SIZE;
}
}
// Check that all parameters have been defined.
if (!amdKernel->parameters().check()) {
return CL_INVALID_KERNEL_ARGS;
}
// Check that all parameters have been defined.
if (!amdKernel->parameters().check()) {
return CL_INVALID_KERNEL_ARGS;
}
// Check that we do not exceed the amount of available local memory.
const size_t align = device.info().minDataTypeAlignSize_;
cl_ulong requiredLocalMemSize =
static_cast<cl_ulong>(amdKernel->parameters().localMemSize(align)) +
amd::alignUp(devKernel->workGroupInfo()->localMemSize_, align);
// Check that we do not exceed the amount of available local memory.
const size_t align = device.info().minDataTypeAlignSize_;
cl_ulong requiredLocalMemSize =
static_cast<cl_ulong>(amdKernel->parameters().localMemSize(align)) +
amd::alignUp(devKernel->workGroupInfo()->localMemSize_, align);
if (requiredLocalMemSize > device.info().localMemSize_) {
return CL_OUT_OF_RESOURCES;
}
if (requiredLocalMemSize > device.info().localMemSize_) {
return CL_OUT_OF_RESOURCES;
}
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::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::NDRangeContainer ndrange((size_t) work_dim,
global_work_offset, global_work_size, local_work_size);
amd::NDRangeKernelCommand* command = new amd::NDRangeKernelCommand(
hostQueue, eventWaitList, *as_amd(kernel), ndrange);
if (command == NULL) {
return CL_OUT_OF_HOST_MEMORY;
}
// ndrange is now owned by command. Do not delete it!
amd::NDRangeContainer ndrange((size_t)work_dim, global_work_offset, global_work_size,
local_work_size);
amd::NDRangeKernelCommand* command =
new amd::NDRangeKernelCommand(hostQueue, eventWaitList, *as_amd(kernel), ndrange);
if (command == NULL) {
return CL_OUT_OF_HOST_MEMORY;
}
// ndrange is now owned by command. Do not delete it!
// Make sure we have memory for the command execution
cl_int result = command->validateMemory();
if (result != CL_SUCCESS) {
delete command;
return result;
}
// Make sure we have memory for the command execution
cl_int result = command->validateMemory();
if (result != CL_SUCCESS) {
delete command;
return result;
}
command->enqueue();
command->enqueue();
*not_null(event) = as_cl(&command->event());
if (event == NULL) {
command->release();
}
return CL_SUCCESS;
*not_null(event) = as_cl(&command->event());
if (event == NULL) {
command->release();
}
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -352,28 +342,24 @@ RUNTIME_EXIT
*
* \version 1.0r33
*/
RUNTIME_ENTRY(cl_int, clEnqueueTask, (
cl_command_queue command_queue,
cl_kernel kernel,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event))
{
static size_t const globalWorkSize[3] = {1, 0, 0};
static size_t const localWorkSize[3] = {1, 0, 0};
RUNTIME_ENTRY(cl_int, clEnqueueTask,
(cl_command_queue command_queue, cl_kernel kernel, cl_uint num_events_in_wait_list,
const cl_event* event_wait_list, 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)) {
return CL_INVALID_COMMAND_QUEUE;
}
if (!is_valid(command_queue)) {
return CL_INVALID_COMMAND_QUEUE;
}
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
if (NULL == hostQueue) {
return CL_INVALID_COMMAND_QUEUE;
}
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
if (NULL == hostQueue) {
return CL_INVALID_COMMAND_QUEUE;
}
return hostQueue->dispatch_->clEnqueueNDRangeKernel(
command_queue, kernel, 1, NULL, globalWorkSize, localWorkSize,
num_events_in_wait_list, event_wait_list, event);
return hostQueue->dispatch_->clEnqueueNDRangeKernel(
command_queue, kernel, 1, NULL, globalWorkSize, localWorkSize, num_events_in_wait_list,
event_wait_list, event);
}
RUNTIME_EXIT
@@ -442,72 +428,62 @@ RUNTIME_EXIT
*
* \version 1.0r33
*/
RUNTIME_ENTRY(cl_int, clEnqueueNativeKernel, (
cl_command_queue command_queue,
void (CL_CALLBACK * user_func)(void *),
void *args,
size_t cb_args,
cl_uint num_mem_objects,
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;
RUNTIME_ENTRY(cl_int, clEnqueueNativeKernel,
(cl_command_queue command_queue, void(CL_CALLBACK* user_func)(void*), void* args,
size_t cb_args, cl_uint num_mem_objects, 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)) {
return CL_INVALID_COMMAND_QUEUE;
if (!is_valid(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();
if (NULL == queue) {
return CL_INVALID_COMMAND_QUEUE;
}
amd::HostQueue& hostQueue = *queue;
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;
}
const amd::Device& device = hostQueue.device();
command->enqueue();
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::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;
*not_null(event) = as_cl(&command->event());
if (event == NULL) {
command->release();
}
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -581,31 +557,28 @@ RUNTIME_EXIT
*
* \version 1.0r33
*/
RUNTIME_ENTRY(cl_int, clEnqueueMarker, (
cl_command_queue command_queue,
cl_event *event))
{
if (!is_valid(command_queue)) {
return CL_INVALID_COMMAND_QUEUE;
}
RUNTIME_ENTRY(cl_int, clEnqueueMarker, (cl_command_queue command_queue, cl_event* event)) {
if (!is_valid(command_queue)) {
return CL_INVALID_COMMAND_QUEUE;
}
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
if (NULL == hostQueue) {
return CL_INVALID_COMMAND_QUEUE;
}
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
if (NULL == hostQueue) {
return CL_INVALID_COMMAND_QUEUE;
}
amd::Command* command = new amd::Marker(*hostQueue, true);
if (command == NULL) {
return CL_OUT_OF_HOST_MEMORY;
}
amd::Command* command = new amd::Marker(*hostQueue, true);
if (command == NULL) {
return CL_OUT_OF_HOST_MEMORY;
}
command->enqueue();
command->enqueue();
*not_null(event) = as_cl(&command->event());
if (event == NULL) {
command->release();
}
return CL_SUCCESS;
*not_null(event) = as_cl(&command->event());
if (event == NULL) {
command->release();
}
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -653,39 +626,36 @@ RUNTIME_EXIT
*
* \version 1.2r07
*/
RUNTIME_ENTRY(cl_int, clEnqueueMarkerWithWaitList, (
cl_command_queue command_queue,
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;
}
RUNTIME_ENTRY(cl_int, clEnqueueMarkerWithWaitList,
(cl_command_queue command_queue, 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;
}
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
if (NULL == hostQueue) {
return CL_INVALID_COMMAND_QUEUE;
}
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
if (NULL == hostQueue) {
return CL_INVALID_COMMAND_QUEUE;
}
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::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::Command* command = new amd::Marker(*hostQueue, true, eventWaitList);
if (command == NULL) {
return CL_OUT_OF_HOST_MEMORY;
}
command->enqueue();
amd::Command* command = new amd::Marker(*hostQueue, true, eventWaitList);
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;
*not_null(event) = as_cl(&command->event());
if (event == NULL) {
command->release();
}
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -719,35 +689,31 @@ RUNTIME_EXIT
*
* \version 1.0r33
*/
RUNTIME_ENTRY(cl_int, clEnqueueWaitForEvents, (
cl_command_queue command_queue,
cl_uint num_events,
const cl_event *event_list))
{
if (!is_valid(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;
RUNTIME_ENTRY(cl_int, clEnqueueWaitForEvents,
(cl_command_queue command_queue, cl_uint num_events, const cl_event* event_list)) {
if (!is_valid(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;
amd::Command::EventWaitList eventWaitList;
cl_int err = amd::clSetEventWaitList(eventWaitList,
hostQueue.context(), num_events, event_list);
if (err != CL_SUCCESS){
return err;
}
amd::Command::EventWaitList eventWaitList;
cl_int err = amd::clSetEventWaitList(eventWaitList, hostQueue.context(), num_events, event_list);
if (err != CL_SUCCESS) {
return err;
}
amd::Command* command = new amd::Marker(hostQueue, false, eventWaitList);
if (command == NULL) {
return CL_OUT_OF_HOST_MEMORY;
}
amd::Command* command = new amd::Marker(hostQueue, false, eventWaitList);
if (command == NULL) {
return CL_OUT_OF_HOST_MEMORY;
}
command->enqueue();
command->release();
return CL_SUCCESS;
command->enqueue();
command->release();
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -765,10 +731,9 @@ RUNTIME_EXIT
*
* \version 1.0r33
*/
RUNTIME_ENTRY(cl_int, clEnqueueBarrier, (cl_command_queue command_queue))
{
//! @todo: Unimplemented();
return CL_SUCCESS;
RUNTIME_ENTRY(cl_int, clEnqueueBarrier, (cl_command_queue command_queue)) {
//! @todo: Unimplemented();
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -817,41 +782,38 @@ RUNTIME_EXIT
*
* \version 1.2r07
*/
RUNTIME_ENTRY(cl_int, clEnqueueBarrierWithWaitList, (
cl_command_queue command_queue,
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;
}
RUNTIME_ENTRY(cl_int, clEnqueueBarrierWithWaitList,
(cl_command_queue command_queue, 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;
}
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
if (NULL == hostQueue) {
return CL_INVALID_COMMAND_QUEUE;
}
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
if (NULL == hostQueue) {
return CL_INVALID_COMMAND_QUEUE;
}
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::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;
}
//!@note: with the current runtime architecture and in-order execution
//! barrier and marker should be the same operation
amd::Command* command = new amd::Marker(*hostQueue, true, eventWaitList);
if (command == NULL) {
return CL_OUT_OF_HOST_MEMORY;
}
command->enqueue();
//!@note: with the current runtime architecture and in-order execution
//! barrier and marker should be the same operation
amd::Command* command = new amd::Marker(*hostQueue, true, eventWaitList);
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;
*not_null(event) = as_cl(&command->event());
if (event == NULL) {
command->release();
}
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -914,55 +876,51 @@ RUNTIME_EXIT
*
* \version 1.0r33
*/
RUNTIME_ENTRY(cl_int, clGetEventProfilingInfo, (
cl_event event,
cl_profiling_info param_name,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret))
{
if (!is_valid(event)) {
return CL_INVALID_EVENT;
}
RUNTIME_ENTRY(cl_int, clGetEventProfilingInfo,
(cl_event event, cl_profiling_info param_name, size_t param_value_size,
void* param_value, size_t* param_value_size_ret)) {
if (!is_valid(event)) {
return CL_INVALID_EVENT;
}
if (!as_amd(event)->profilingInfo().enabled_) {
return CL_PROFILING_INFO_NOT_AVAILABLE;
}
if (!as_amd(event)->profilingInfo().enabled_) {
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;
}
*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;
}
if (value == 0) {
return CL_PROFILING_INFO_NOT_AVAILABLE;
}
*(cl_ulong*)param_value = value;
if (value == 0) {
return CL_PROFILING_INFO_NOT_AVAILABLE;
}
*(cl_ulong*)param_value = value;
}
return CL_SUCCESS;
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -992,26 +950,25 @@ RUNTIME_EXIT
*
* \version 1.0r33
*/
RUNTIME_ENTRY(cl_int, clFlush, (cl_command_queue command_queue))
{
if (!is_valid(command_queue)) {
return CL_INVALID_COMMAND_QUEUE;
}
RUNTIME_ENTRY(cl_int, clFlush, (cl_command_queue command_queue)) {
if (!is_valid(command_queue)) {
return CL_INVALID_COMMAND_QUEUE;
}
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
if (NULL == hostQueue) {
return CL_INVALID_COMMAND_QUEUE;
}
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
if (NULL == hostQueue) {
return CL_INVALID_COMMAND_QUEUE;
}
amd::Command* command = new amd::Marker(*hostQueue, false);
if (command == NULL) {
return CL_OUT_OF_HOST_MEMORY;
}
amd::Command* command = new amd::Marker(*hostQueue, false);
if (command == NULL) {
return CL_OUT_OF_HOST_MEMORY;
}
command->enqueue();
command->release();
command->enqueue();
command->release();
return CL_SUCCESS;
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -1029,20 +986,19 @@ RUNTIME_EXIT
*
* \version 1.0r33
*/
RUNTIME_ENTRY(cl_int, clFinish, (cl_command_queue command_queue))
{
if (!is_valid(command_queue)) {
return CL_INVALID_COMMAND_QUEUE;
}
RUNTIME_ENTRY(cl_int, clFinish, (cl_command_queue command_queue)) {
if (!is_valid(command_queue)) {
return CL_INVALID_COMMAND_QUEUE;
}
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
if (NULL == hostQueue) {
return CL_INVALID_COMMAND_QUEUE;
}
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
if (NULL == hostQueue) {
return CL_INVALID_COMMAND_QUEUE;
}
hostQueue->finish();
hostQueue->finish();
return CL_SUCCESS;
return CL_SUCCESS;
}
RUNTIME_EXIT
Plik diff jest za duży Load Diff
+167 -285
Wyświetl plik
@@ -8,336 +8,218 @@
#include "cl_d3d9_amd.hpp"
#include "cl_d3d10_amd.hpp"
#include "cl_d3d11_amd.hpp"
#endif //_WIN32
#endif //_WIN32
#include <icd/icd_dispatch.h>
amd::PlatformIDS amd::PlatformID::Platform = //{ NULL };
{ amd::ICDDispatchedObject::icdVendorDispatch_ };
amd::PlatformIDS amd::PlatformID::Platform = //{ NULL };
{amd::ICDDispatchedObject::icdVendorDispatch_};
static cl_int CL_API_CALL
icdGetPlatformInfo(
cl_platform_id platform,
cl_platform_info param_name,
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 icdGetPlatformInfo(cl_platform_id platform, cl_platform_info param_name,
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
icdGetDeviceIDs(
cl_platform_id platform,
cl_device_type device_type,
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 icdGetDeviceIDs(cl_platform_id platform, cl_device_type device_type,
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
icdGetDeviceInfo(
cl_device_id device,
cl_device_info param_name,
size_t param_value_size,
void * param_value,
size_t * 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);
}
static cl_int CL_API_CALL icdGetDeviceInfo(cl_device_id device, cl_device_info param_name,
size_t param_value_size, void* param_value,
size_t* 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(
device, param_name, param_value_size, param_value, param_value_size_ret);
return clGetDeviceInfo(device, param_name, param_value_size, param_value, param_value_size_ret);
}
KHRicdVendorDispatch
amd::ICDDispatchedObject::icdVendorDispatch_[] = {{
NULL /* should not get called */,
icdGetPlatformInfo,
icdGetDeviceIDs,
icdGetDeviceInfo,
clCreateContext,
clCreateContextFromType,
clRetainContext,
clReleaseContext,
clGetContextInfo,
clCreateCommandQueue,
clRetainCommandQueue,
clReleaseCommandQueue,
clGetCommandQueueInfo,
clSetCommandQueueProperty,
clCreateBuffer,
clCreateImage2D,
clCreateImage3D,
clRetainMemObject,
clReleaseMemObject,
clGetSupportedImageFormats,
clGetMemObjectInfo,
clGetImageInfo,
clCreateSampler,
clRetainSampler,
clReleaseSampler,
clGetSamplerInfo,
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,
KHRicdVendorDispatch amd::ICDDispatchedObject::icdVendorDispatch_[] = {
{NULL /* should not get called */, icdGetPlatformInfo, icdGetDeviceIDs, icdGetDeviceInfo,
clCreateContext, clCreateContextFromType, clRetainContext, clReleaseContext, clGetContextInfo,
clCreateCommandQueue, clRetainCommandQueue, clReleaseCommandQueue, clGetCommandQueueInfo,
clSetCommandQueueProperty, clCreateBuffer, clCreateImage2D, clCreateImage3D, clRetainMemObject,
clReleaseMemObject, clGetSupportedImageFormats, clGetMemObjectInfo, clGetImageInfo,
clCreateSampler, clRetainSampler, clReleaseSampler, clGetSamplerInfo,
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*/
clCreateSubDevices,
clRetainDevice,
clReleaseDevice,
clCreateImage,
clCreateProgramWithBuiltInKernels,
clCompileProgram,
clLinkProgram,
clUnloadPlatformCompiler,
clGetKernelArgInfo,
clEnqueueFillBuffer,
clEnqueueFillImage,
clEnqueueMigrateMemObjects,
clEnqueueMarkerWithWaitList,
clEnqueueBarrierWithWaitList,
clGetExtensionFunctionAddressForPlatform,
clCreateFromGLTexture,
/* OpenCL 1.2*/
clCreateSubDevices, clRetainDevice, clReleaseDevice, clCreateImage,
clCreateProgramWithBuiltInKernels, clCompileProgram, clLinkProgram, clUnloadPlatformCompiler,
clGetKernelArgInfo, clEnqueueFillBuffer, clEnqueueFillImage, clEnqueueMigrateMemObjects,
clEnqueueMarkerWithWaitList, clEnqueueBarrierWithWaitList,
clGetExtensionFunctionAddressForPlatform, clCreateFromGLTexture,
WINDOWS_SWITCH(clGetDeviceIDsFromD3D11KHR,NULL),
WINDOWS_SWITCH(clCreateFromD3D11BufferKHR,NULL),
WINDOWS_SWITCH(clCreateFromD3D11Texture2DKHR,NULL),
WINDOWS_SWITCH(clCreateFromD3D11Texture3DKHR,NULL),
WINDOWS_SWITCH(clCreateFromDX9MediaSurfaceKHR, NULL),
WINDOWS_SWITCH(clEnqueueAcquireD3D11ObjectsKHR,NULL),
WINDOWS_SWITCH(clEnqueueReleaseD3D11ObjectsKHR,NULL),
WINDOWS_SWITCH(clGetDeviceIDsFromD3D11KHR, NULL),
WINDOWS_SWITCH(clCreateFromD3D11BufferKHR, NULL),
WINDOWS_SWITCH(clCreateFromD3D11Texture2DKHR, NULL),
WINDOWS_SWITCH(clCreateFromD3D11Texture3DKHR, NULL),
WINDOWS_SWITCH(clCreateFromDX9MediaSurfaceKHR, NULL),
WINDOWS_SWITCH(clEnqueueAcquireD3D11ObjectsKHR, NULL),
WINDOWS_SWITCH(clEnqueueReleaseD3D11ObjectsKHR, NULL),
WINDOWS_SWITCH(clGetDeviceIDsFromDX9MediaAdapterKHR,NULL),//KHRpfn_clGetDeviceIDsFromDX9MediaAdapterKHR clGetDeviceIDsFromDX9MediaAdapterKHR;
WINDOWS_SWITCH(clEnqueueAcquireDX9MediaSurfacesKHR, NULL), //KHRpfn_clEnqueueAcquireDX9MediaSurfacesKHR clEnqueueAcquireDX9MediaSurfacesKHR;
WINDOWS_SWITCH(clEnqueueReleaseDX9MediaSurfacesKHR, NULL), //KHRpfn_clEnqueueReleaseDX9MediaSurfacesKHR clEnqueueReleaseDX9MediaSurfacesKHR;
WINDOWS_SWITCH(clGetDeviceIDsFromDX9MediaAdapterKHR,
NULL), // KHRpfn_clGetDeviceIDsFromDX9MediaAdapterKHR
// clGetDeviceIDsFromDX9MediaAdapterKHR;
WINDOWS_SWITCH(
clEnqueueAcquireDX9MediaSurfacesKHR,
NULL), // KHRpfn_clEnqueueAcquireDX9MediaSurfacesKHR clEnqueueAcquireDX9MediaSurfacesKHR;
WINDOWS_SWITCH(
clEnqueueReleaseDX9MediaSurfacesKHR,
NULL), // KHRpfn_clEnqueueReleaseDX9MediaSurfacesKHR clEnqueueReleaseDX9MediaSurfacesKHR;
NULL,
NULL,
NULL,
NULL,
NULL,
NULL, NULL, NULL,
clCreateCommandQueueWithProperties,
clCreatePipe,
clGetPipeInfo,
clSVMAlloc,
clSVMFree,
clEnqueueSVMFree,
clEnqueueSVMMemcpy,
clEnqueueSVMMemFill,
clEnqueueSVMMap,
clEnqueueSVMUnmap,
clCreateSamplerWithProperties,
clSetKernelArgSVMPointer,
clSetKernelExecInfo,
clCreateCommandQueueWithProperties, clCreatePipe, clGetPipeInfo, clSVMAlloc, clSVMFree,
clEnqueueSVMFree, clEnqueueSVMMemcpy, clEnqueueSVMMemFill, clEnqueueSVMMap, clEnqueueSVMUnmap,
clCreateSamplerWithProperties, clSetKernelArgSVMPointer, clSetKernelExecInfo,
clGetKernelSubGroupInfoKHR,
clTerminateContextKHR,
clCreateProgramWithILKHR
}};
clGetKernelSubGroupInfoKHR, clTerminateContextKHR, clCreateProgramWithILKHR}};
#if defined(ATI_OS_WIN)
#include <Shlwapi.h>
#pragma comment( lib, "shlwapi.lib")
#pragma comment(lib, "shlwapi.lib")
static bool
ShouldLoadPlatform()
{
// Get the OpenCL ICD registry values
HKEY platformsKey = NULL;
if (RegOpenKeyExA(
HKEY_LOCAL_MACHINE, "SOFTWARE\\Khronos\\OpenCL\\Vendors",
0, KEY_READ, &platformsKey)
!= ERROR_SUCCESS) return true;
static bool ShouldLoadPlatform() {
// Get the OpenCL ICD registry values
HKEY platformsKey = NULL;
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Khronos\\OpenCL\\Vendors", 0, KEY_READ,
&platformsKey) != ERROR_SUCCESS)
return true;
std::vector<std::string> registryValues;
DWORD dwIndex = 0;
while (true) {
char cszLibraryName[1024] = {0};
DWORD dwLibraryNameSize = sizeof(cszLibraryName);
DWORD dwLibraryNameType = 0;
DWORD dwValue = 0;
DWORD dwValueSize = sizeof(dwValue);
std::vector<std::string> registryValues;
DWORD dwIndex = 0;
while (true) {
char cszLibraryName[1024] = {0};
DWORD dwLibraryNameSize = sizeof(cszLibraryName);
DWORD dwLibraryNameType = 0;
DWORD dwValue = 0;
DWORD dwValueSize = sizeof(dwValue);
if (RegEnumValueA(
platformsKey, dwIndex++, cszLibraryName, &dwLibraryNameSize,
NULL, &dwLibraryNameType, (LPBYTE) &dwValue, &dwValueSize)
!= ERROR_SUCCESS) break;
// Require that the value be a DWORD and equal zero
if (dwLibraryNameType != REG_DWORD || dwValue != 0) {
continue;
}
registryValues.push_back(cszLibraryName);
if (RegEnumValueA(platformsKey, dwIndex++, cszLibraryName, &dwLibraryNameSize, NULL,
&dwLibraryNameType, (LPBYTE)&dwValue, &dwValueSize) != ERROR_SUCCESS)
break;
// Require that the value be a DWORD and equal zero
if (dwLibraryNameType != REG_DWORD || dwValue != 0) {
continue;
}
RegCloseKey(platformsKey);
registryValues.push_back(cszLibraryName);
}
RegCloseKey(platformsKey);
HMODULE hm = NULL;
if (!GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
| GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
(LPCSTR) &ShouldLoadPlatform, &hm)) return true;
HMODULE hm = NULL;
if (!GetModuleHandleExA(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
(LPCSTR)&ShouldLoadPlatform, &hm))
return true;
char cszDllPath[1024] = {0};
if (!GetModuleFileNameA(hm, cszDllPath, sizeof(cszDllPath)))
return true;
char cszDllPath[1024] = {0};
if (!GetModuleFileNameA(hm, cszDllPath, sizeof(cszDllPath))) return true;
// If we are loaded from the DriverStore, then there should be a registry
// value matching our current module absolute path.
if (std::find(registryValues.begin(), registryValues.end(), cszDllPath)
== registryValues.end()) return true;
// If we are loaded from the DriverStore, then there should be a registry
// value matching our current module absolute path.
if (std::find(registryValues.begin(), registryValues.end(), cszDllPath) == registryValues.end())
return true;
LPSTR cszFileName;
char buffer[1024] = {0};
if (!GetFullPathNameA(cszDllPath, sizeof(buffer), buffer, &cszFileName))
return true;
LPSTR cszFileName;
char buffer[1024] = {0};
if (!GetFullPathNameA(cszDllPath, sizeof(buffer), buffer, &cszFileName)) return true;
// We found an absolute path in the registry that matched this DLL, now
// check if there is also an entry with the same filename.
if (std::find(registryValues.begin(), registryValues.end(), cszFileName)
== registryValues.end()) return true;
// We found an absolute path in the registry that matched this DLL, now
// check if there is also an entry with the same filename.
if (std::find(registryValues.begin(), registryValues.end(), cszFileName) == registryValues.end())
return true;
// Lastly, check if there is a DLL with the same name in the System folder.
char cszSystemPath[1024] = {0};
// Lastly, check if there is a DLL with the same name in the System folder.
char cszSystemPath[1024] = {0};
#if defined(ATI_BITS_32)
if (!GetSystemWow64DirectoryA(cszSystemPath, sizeof(cszSystemPath)))
#endif // defined(ATI_BITS_32)
if (!GetSystemDirectoryA(cszSystemPath, sizeof(cszSystemPath)))
return true;
if (!GetSystemWow64DirectoryA(cszSystemPath, sizeof(cszSystemPath)))
#endif // defined(ATI_BITS_32)
if (!GetSystemDirectoryA(cszSystemPath, sizeof(cszSystemPath))) return true;
std::string systemDllPath;
systemDllPath.append(cszSystemPath).append("\\").append(cszFileName);
if (!PathFileExistsA(systemDllPath.c_str())) {
return true;
}
std::string systemDllPath;
systemDllPath.append(cszSystemPath).append("\\").append(cszFileName);
if (!PathFileExistsA(systemDllPath.c_str())) {
return 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 a relative path matches the current DLL
// - A DLL with the same name was found in the system directory
//
// We should not load this platform!
// 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 a relative path matches the current DLL
// - A DLL with the same name was found in the system directory
//
// We should not load this platform!
return false;
return false;
}
static BOOL CALLBACK
ShouldLoadPlatformInit(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *lpContex)
{
*reinterpret_cast<bool*>(Parameter) = ShouldLoadPlatform();
return TRUE;
static BOOL CALLBACK ShouldLoadPlatformInit(PINIT_ONCE InitOnce, PVOID Parameter, PVOID* lpContex) {
*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
clIcdGetPlatformIDsKHR(
cl_uint num_entries,
cl_platform_id * platforms,
cl_uint * num_platforms)
{
if (((num_entries > 0 || num_platforms == NULL) && platforms == NULL)
|| (num_entries == 0 && platforms != NULL)) {
return CL_INVALID_VALUE;
}
CL_API_ENTRY cl_int CL_API_CALL clIcdGetPlatformIDsKHR(cl_uint num_entries,
cl_platform_id* platforms,
cl_uint* num_platforms) {
if (((num_entries > 0 || num_platforms == NULL) && platforms == NULL) ||
(num_entries == 0 && platforms != NULL)) {
return CL_INVALID_VALUE;
}
#if defined(ATI_OS_WIN)
static bool shouldLoad = true;
static bool shouldLoad = true;
static INIT_ONCE initOnce;
InitOnceExecuteOnce(&initOnce, ShouldLoadPlatformInit, &shouldLoad, NULL);
static INIT_ONCE initOnce;
InitOnceExecuteOnce(&initOnce, ShouldLoadPlatformInit, &shouldLoad, NULL);
if (!shouldLoad) {
*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;
if (!shouldLoad) {
*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;
}
Plik diff jest za duży Load Diff
+98 -72
Wyświetl plik
@@ -10,114 +10,140 @@ struct clk_builtins_t;
// This must be a multiple of sizeof(cl_ulong16)
#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
{
// Warning! The size of this struct needs to be a multiple
// of 16 when compiling 64 bit
struct clk_thread_info_block_t {
// Warning! The size of this struct needs to be a multiple
// of 16 when compiling 64 bit
struct clk_builtins_t const * builtins;
void * local_mem_base;
void * local_scratch;
const void * table_base;
size_t pad;
struct clk_builtins_t const* builtins;
void* local_mem_base;
void* local_scratch;
const void* table_base;
size_t pad;
uint work_dim;
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)*/
uint work_dim;
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 enqueued_local_size[4];
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 group_id[4]; /*dim0,dim1,dim2,invalid(dim<0||dim>2)*/
size_t enqueued_local_size[4];
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 group_id[4]; /*dim0,dim1,dim2,invalid(dim<0||dim>2)*/
};
typedef enum clk_value_type_t
{
T_VOID, T_CHAR, T_SHORT, T_INT,
T_LONG, T_FLOAT, T_DOUBLE, T_POINTER,
T_CHAR2, 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
typedef enum clk_value_type_t {
T_VOID,
T_CHAR,
T_SHORT,
T_INT,
T_LONG,
T_FLOAT,
T_DOUBLE,
T_POINTER,
T_CHAR2,
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;
typedef enum clk_address_space_t
{
A_PRIVATE, A_LOCAL, A_CONSTANT, A_GLOBAL, A_REGION
typedef enum clk_address_space_t {
A_PRIVATE,
A_LOCAL,
A_CONSTANT,
A_GLOBAL,
A_REGION
} clk_address_space_t;
//kernel arg access qualifier and type qualifier
typedef enum clk_arg_qualifier_t
{
Q_NONE = 0,
// kernel arg access qualifier and type qualifier
typedef enum clk_arg_qualifier_t {
Q_NONE = 0,
//for image type only, access qualifier
Q_READ = 1,
Q_WRITE = 2,
// for image type only, access qualifier
Q_READ = 1,
Q_WRITE = 2,
//for pointer type only
Q_CONST = 4, // pointee
Q_RESTRICT = 8,
Q_VOLATILE = 16, // pointee
Q_PIPE = 32 // pipe
// for pointer type only
Q_CONST = 4, // pointee
Q_RESTRICT = 8,
Q_VOLATILE = 16, // pointee
Q_PIPE = 32 // pipe
} clk_arg_qualifier_t;
#pragma pack(push, 4)
struct clk_parameter_descriptor_t
{
clk_value_type_t type;
clk_address_space_t space;
uint qualifier;
const char* name;
struct clk_parameter_descriptor_t {
clk_value_type_t type;
clk_address_space_t space;
uint qualifier;
const char* name;
};
#pragma pack(pop)
//#define CLK_LOCAL_MEM_FENCE (1 << 0)
//#define CLK_GLOBAL_MEM_FENCE (1 << 1)
struct clk_builtins_t
{
/* Synchronization functions */
void (*barrier_ptr)(cl_mem_fence_flags flags);
struct clk_builtins_t {
/* Synchronization functions */
void (*barrier_ptr)(cl_mem_fence_flags flags);
/* AMD Only builtins: FIXME_lmoriche (extension) */
void* reserved;
int (*printf_ptr)(const char *format, ...);
/* AMD Only builtins: FIXME_lmoriche (extension) */
void* reserved;
int (*printf_ptr)(const char* format, ...);
};
enum clk_natures_t
{
KN_HAS_BARRIER = 1 << 0,
KN_WG_LEVEL = 1 << 1
};
enum clk_natures_t { KN_HAS_BARRIER = 1 << 0, KN_WG_LEVEL = 1 << 1 };
#if defined(_MSC_VER)
#pragma warning( push )
#pragma warning( disable : 4200 )
#pragma warning(push)
#pragma warning(disable : 4200)
#endif
#if !defined(__OPENCL_VERSION__) || __OPENCL_VERSION__ >= 200
typedef struct clk_pipe_t
{
size_t read_idx;
size_t write_idx;
size_t end_idx;
char padding[128 - 3*sizeof(size_t)];
char packets[];
typedef struct clk_pipe_t {
size_t read_idx;
size_t write_idx;
size_t end_idx;
char padding[128 - 3 * sizeof(size_t)];
char packets[];
} clk_pipe_t;
#endif
#if defined(_MSC_VER)
#pragma warning( pop )
#pragma warning(pop)
#endif
#endif /*CL_KERNEL_H_*/
@@ -42,92 +42,73 @@
* \a param_value is not NULL
* - CL_INVALID_KERNEL if \a kernel is a not a valid program object
*/
RUNTIME_ENTRY(cl_int, clGetKernelInfoAMD, (
cl_kernel kernel,
cl_device_id device,
cl_kernel_info_amd param_name,
size_t param_value_size,
void* param_value,
size_t* param_value_size_ret))
{
// Check if we have a valid device
if (!is_valid(device)) {
return CL_INVALID_DEVICE;
}
RUNTIME_ENTRY(cl_int, clGetKernelInfoAMD,
(cl_kernel kernel, cl_device_id device, cl_kernel_info_amd param_name,
size_t param_value_size, void* param_value, 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
if (!is_valid(kernel)) {
return CL_INVALID_KERNEL;
}
// Check if we have a valid performance counter
if (!is_valid(kernel)) {
return CL_INVALID_KERNEL;
}
// Find the kernel, associated with the specified device
const device::Kernel* devKernel =
as_amd(kernel)->getDeviceKernel(*as_amd(device));
// Find the kernel, associated with the specified device
const device::Kernel* devKernel = as_amd(kernel)->getDeviceKernel(*as_amd(device));
// Make sure we found a valid kernel
if (devKernel == NULL) {
return CL_INVALID_KERNEL;
}
// Make sure we found a valid kernel
if (devKernel == NULL) {
return CL_INVALID_KERNEL;
}
// Get the corresponded parameters
switch (param_name) {
// Get the corresponded parameters
switch (param_name) {
case CL_KERNELINFO_SCRATCH_REGS:
return amd::clGetInfo(
devKernel->workGroupInfo()->scratchRegs_,
param_value_size, param_value, param_value_size_ret);
return amd::clGetInfo(devKernel->workGroupInfo()->scratchRegs_, param_value_size, param_value,
param_value_size_ret);
case CL_KERNELINFO_WAVEFRONT_PER_SIMD:
return amd::clGetInfo(
devKernel->workGroupInfo()->wavefrontPerSIMD_,
param_value_size, param_value, param_value_size_ret);
return amd::clGetInfo(devKernel->workGroupInfo()->wavefrontPerSIMD_, param_value_size,
param_value, param_value_size_ret);
case CL_KERNELINFO_WAVEFRONT_SIZE:
return amd::clGetInfo(
devKernel->workGroupInfo()->wavefrontSize_,
param_value_size, param_value, param_value_size_ret);
return amd::clGetInfo(devKernel->workGroupInfo()->wavefrontSize_, param_value_size,
param_value, param_value_size_ret);
case CL_KERNELINFO_AVAILABLE_GPRS:
return amd::clGetInfo(
devKernel->workGroupInfo()->availableGPRs_,
param_value_size, param_value, param_value_size_ret);
return amd::clGetInfo(devKernel->workGroupInfo()->availableGPRs_, param_value_size,
param_value, param_value_size_ret);
case CL_KERNELINFO_USED_GPRS:
return amd::clGetInfo(
devKernel->workGroupInfo()->usedGPRs_,
param_value_size, param_value, param_value_size_ret);
return amd::clGetInfo(devKernel->workGroupInfo()->usedGPRs_, param_value_size, param_value,
param_value_size_ret);
case CL_KERNELINFO_AVAILABLE_SGPRS:
return amd::clGetInfo(
devKernel->workGroupInfo()->availableSGPRs_,
param_value_size, param_value, param_value_size_ret);
return amd::clGetInfo(devKernel->workGroupInfo()->availableSGPRs_, param_value_size,
param_value, param_value_size_ret);
case CL_KERNELINFO_USED_SGPRS:
return amd::clGetInfo(
devKernel->workGroupInfo()->usedSGPRs_,
param_value_size, param_value, param_value_size_ret);
return amd::clGetInfo(devKernel->workGroupInfo()->usedSGPRs_, param_value_size, param_value,
param_value_size_ret);
case CL_KERNELINFO_AVAILABLE_VGPRS:
return amd::clGetInfo(
devKernel->workGroupInfo()->availableVGPRs_,
param_value_size, param_value, param_value_size_ret);
return amd::clGetInfo(devKernel->workGroupInfo()->availableVGPRs_, param_value_size,
param_value, param_value_size_ret);
case CL_KERNELINFO_USED_VGPRS:
return amd::clGetInfo(
devKernel->workGroupInfo()->usedVGPRs_,
param_value_size, param_value, param_value_size_ret);
return amd::clGetInfo(devKernel->workGroupInfo()->usedVGPRs_, param_value_size, param_value,
param_value_size_ret);
case CL_KERNELINFO_AVAILABLE_LDS_SIZE:
return amd::clGetInfo(
devKernel->workGroupInfo()->availableLDSSize_,
param_value_size, param_value, param_value_size_ret);
return amd::clGetInfo(devKernel->workGroupInfo()->availableLDSSize_, param_value_size,
param_value, param_value_size_ret);
case CL_KERNELINFO_USED_LDS_SIZE:
return amd::clGetInfo(
devKernel->workGroupInfo()->usedLDSSize_,
param_value_size, param_value, param_value_size_ret);
return amd::clGetInfo(devKernel->workGroupInfo()->usedLDSSize_, param_value_size, param_value,
param_value_size_ret);
case CL_KERNELINFO_AVAILABLE_STACK_SIZE:
return amd::clGetInfo(
devKernel->workGroupInfo()->availableStackSize_,
param_value_size, param_value, param_value_size_ret);
return amd::clGetInfo(devKernel->workGroupInfo()->availableStackSize_, param_value_size,
param_value, param_value_size_ret);
case CL_KERNELINFO_USED_STACK_SIZE:
return amd::clGetInfo(
devKernel->workGroupInfo()->usedStackSize_,
param_value_size, param_value, param_value_size_ret);
return amd::clGetInfo(devKernel->workGroupInfo()->usedStackSize_, param_value_size,
param_value, param_value_size_ret);
default:
return CL_INVALID_VALUE;
}
return CL_INVALID_VALUE;
}
return CL_SUCCESS;
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -102,23 +102,22 @@ extern "C" {
typedef cl_uint cl_kernel_info_amd;
/* cl_kernel_info */
enum KernelInfoAMD
{
CL_KERNELINFO_NONE = 0x0,
CL_KERNELINFO_SCRATCH_REGS,
CL_KERNELINFO_WAVEFRONT_PER_SIMD,
CL_KERNELINFO_WAVEFRONT_SIZE,
CL_KERNELINFO_AVAILABLE_GPRS,
CL_KERNELINFO_USED_GPRS,
CL_KERNELINFO_AVAILABLE_LDS_SIZE,
CL_KERNELINFO_USED_LDS_SIZE,
CL_KERNELINFO_AVAILABLE_STACK_SIZE,
CL_KERNELINFO_USED_STACK_SIZE,
CL_KERNELINFO_AVAILABLE_SGPRS,
CL_KERNELINFO_USED_SGPRS,
CL_KERNELINFO_AVAILABLE_VGPRS,
CL_KERNELINFO_USED_VGPRS,
CL_KERNELINFO_LAST
enum KernelInfoAMD {
CL_KERNELINFO_NONE = 0x0,
CL_KERNELINFO_SCRATCH_REGS,
CL_KERNELINFO_WAVEFRONT_PER_SIMD,
CL_KERNELINFO_WAVEFRONT_SIZE,
CL_KERNELINFO_AVAILABLE_GPRS,
CL_KERNELINFO_USED_GPRS,
CL_KERNELINFO_AVAILABLE_LDS_SIZE,
CL_KERNELINFO_USED_LDS_SIZE,
CL_KERNELINFO_AVAILABLE_STACK_SIZE,
CL_KERNELINFO_USED_STACK_SIZE,
CL_KERNELINFO_AVAILABLE_SGPRS,
CL_KERNELINFO_USED_SGPRS,
CL_KERNELINFO_AVAILABLE_VGPRS,
CL_KERNELINFO_USED_VGPRS,
CL_KERNELINFO_LAST
};
/*! \brief Retrieves the kernel information.
@@ -148,18 +147,13 @@ enum KernelInfoAMD
* \a param_value is not NULL
* - CL_INVALID_KERNEL if \a kernel is a not a valid program object
*/
extern CL_API_ENTRY cl_int CL_API_CALL
clGetKernelInfoAMD(
cl_kernel /* kernel */,
cl_device_id /* device */,
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;
extern CL_API_ENTRY cl_int CL_API_CALL clGetKernelInfoAMD(
cl_kernel /* kernel */, cl_device_id /* device */, 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
} /*extern "C"*/
#endif /*__cplusplus*/
#endif /*__CL_KERNEL_INFO_AMD_H*/
#endif /*__CL_KERNEL_INFO_AMD_H*/
+205 -274
Wyświetl plik
@@ -11,98 +11,89 @@
#if defined __linux__
typedef wchar_t char_t;
#endif // __linux__
#endif // __linux__
#if !defined(BUILD_HSA_TARGET) && defined(_WIN32)
#define WITH_LIQUID_FLASH 1
#endif // _WIN32
#endif // _WIN32
#if defined(WITH_LIQUID_FLASH)
#include "lf.h"
#endif // WITH_LIQUID_FLASH
#endif // WITH_LIQUID_FLASH
namespace amd {
LiquidFlashFile::~LiquidFlashFile()
{
close();
LiquidFlashFile::~LiquidFlashFile() { 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
LiquidFlashFile::open()
{
void LiquidFlashFile::close() {
#if defined WITH_LIQUID_FLASH
lf_status err;
lf_file_flags flags;
if (handle_ != NULL) {
lfReleaseFile((lf_file)handle_);
handle_ = NULL;
}
#endif // WITH_LIQUID_FLASH
}
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;
}
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;
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;
}
lf_region_descriptor region = {fileOffset / blockSize(), bufferOffset / blockSize(),
size / blockSize()};
if (writeBuffer) {
status = lfReadFile(srcDst, bufferSize, (lf_file)handle_, 1, &region, NULL);
} else {
status = lfWriteFile(srcDst, bufferSize, (lf_file)handle_, 1, &region, NULL);
}
if (lf_success == status) {
return true;
#else
} else {
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, &region, NULL);
}
else {
status = lfWriteFile(srcDst, bufferSize, (lf_file)handle_, 1, &region, NULL);
}
if (lf_success == status) {
return true;
}
else {
return false;
}
}
#else
return false;
#endif // WITH_LIQUID_FLASH
return false;
#endif // WITH_LIQUID_FLASH
}
} // namespace amd
} // namespace amd
/*! \addtogroup API
* @{
@@ -112,224 +103,164 @@ LiquidFlashFile::transferBlock(
*
*/
RUNTIME_ENTRY_RET(cl_file_amd, clCreateSsgFileObjectAMD, (
cl_context context,
cl_file_flags_amd flags,
const wchar_t* file_name,
cl_int* errcode_ret))
{
amd::LiquidFlashFile* file = new amd::LiquidFlashFile(file_name, flags);
RUNTIME_ENTRY_RET(cl_file_amd, clCreateSsgFileObjectAMD,
(cl_context context, cl_file_flags_amd flags, const wchar_t* file_name,
cl_int* errcode_ret)) {
amd::LiquidFlashFile* file = new amd::LiquidFlashFile(file_name, flags);
if (file == NULL) {
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
return (cl_file_amd)0;
}
if (file == NULL) {
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
return (cl_file_amd)0;
}
if (!file->open()) {
*not_null(errcode_ret) = CL_INVALID_VALUE;
delete file;
return (cl_file_amd)0;
}
if (!file->open()) {
*not_null(errcode_ret) = CL_INVALID_VALUE;
delete file;
return (cl_file_amd)0;
}
*not_null(errcode_ret) = CL_SUCCESS;
return as_cl(file);
*not_null(errcode_ret) = CL_SUCCESS;
return as_cl(file);
}
RUNTIME_EXIT
RUNTIME_ENTRY(cl_int, clGetSsgFileObjectInfoAMD, (
cl_file_amd file,
cl_file_info_amd param_name,
size_t param_value_size,
void * param_value,
size_t * param_value_size_ret))
{
if (!is_valid(file)) {
return CL_INVALID_FILE_OBJECT_AMD;
}
RUNTIME_ENTRY(cl_int, clGetSsgFileObjectInfoAMD,
(cl_file_amd file, cl_file_info_amd param_name, size_t param_value_size,
void* param_value, 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: {
cl_uint blockSize = as_amd(file)->blockSize();
return amd::clGetInfo(
blockSize, param_value_size, param_value, param_value_size_ret);
cl_uint blockSize = as_amd(file)->blockSize();
return amd::clGetInfo(blockSize, param_value_size, param_value, param_value_size_ret);
}
case CL_FILE_SIZE_AMD: {
cl_ulong fileSize = as_amd(file)->fileSize();
return amd::clGetInfo(
fileSize, param_value_size, param_value, param_value_size_ret);
cl_ulong fileSize = as_amd(file)->fileSize();
return amd::clGetInfo(fileSize, param_value_size, param_value, param_value_size_ret);
}
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;
}
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, 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;
}
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_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
+17 -42
Wyświetl plik
@@ -8,53 +8,28 @@ extern "C" {
#endif /*__cplusplus*/
extern CL_API_ENTRY cl_file_amd CL_API_CALL
clCreateSsgFileObjectAMD(
cl_context context,
cl_file_flags_amd flags,
const wchar_t * file_name,
cl_int * errcode_ret) CL_EXT_SUFFIX__VERSION_1_2;
clCreateSsgFileObjectAMD(cl_context context, 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
clGetSsgFileObjectInfoAMD(
cl_file_amd file,
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 clGetSsgFileObjectInfoAMD(
cl_file_amd file, 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
clRetainSsgFileObjectAMD(
cl_file_amd file) CL_EXT_SUFFIX__VERSION_1_2;
extern CL_API_ENTRY cl_int CL_API_CALL clRetainSsgFileObjectAMD(cl_file_amd file)
CL_EXT_SUFFIX__VERSION_1_2;
extern CL_API_ENTRY cl_int CL_API_CALL
clReleaseSsgFileObjectAMD(
cl_file_amd file) CL_EXT_SUFFIX__VERSION_1_2;
extern CL_API_ENTRY cl_int CL_API_CALL clReleaseSsgFileObjectAMD(cl_file_amd file)
CL_EXT_SUFFIX__VERSION_1_2;
extern CL_API_ENTRY cl_int CL_API_CALL
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) CL_EXT_SUFFIX__VERSION_1_2;
extern CL_API_ENTRY cl_int CL_API_CALL 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) CL_EXT_SUFFIX__VERSION_1_2;
extern CL_API_ENTRY cl_int CL_API_CALL
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) CL_EXT_SUFFIX__VERSION_1_2;
extern CL_API_ENTRY cl_int CL_API_CALL 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) CL_EXT_SUFFIX__VERSION_1_2;
#ifdef __cplusplus
} /*extern "C"*/
Plik diff jest za duży Load Diff
+39 -50
Wyświetl plik
@@ -4,69 +4,58 @@
#include "cl_common.hpp"
RUNTIME_ENTRY_RET(cl_key_amd, clCreateKeyAMD, (
cl_platform_id platform,
void (CL_CALLBACK * destructor)( void* ),
cl_int *errcode_ret))
{
cl_key_amd key = amd::ObjectMetadata::createKey(destructor);
RUNTIME_ENTRY_RET(cl_key_amd, clCreateKeyAMD,
(cl_platform_id platform, void(CL_CALLBACK* destructor)(void*),
cl_int* errcode_ret)) {
cl_key_amd key = amd::ObjectMetadata::createKey(destructor);
*not_null(errcode_ret) = amd::ObjectMetadata::check(key)
? CL_SUCCESS : CL_OUT_OF_RESOURCES;
*not_null(errcode_ret) = amd::ObjectMetadata::check(key) ? CL_SUCCESS : CL_OUT_OF_RESOURCES;
return key;
return key;
}
RUNTIME_EXIT
RUNTIME_ENTRY(cl_int, clObjectGetValueForKeyAMD, (
void * object,
cl_key_amd key,
void ** ret_val))
{
if (ret_val == NULL) {
return CL_INVALID_VALUE;
}
*ret_val = NULL;
RUNTIME_ENTRY(cl_int, clObjectGetValueForKeyAMD, (void* object, cl_key_amd key, void** ret_val)) {
if (ret_val == NULL) {
return CL_INVALID_VALUE;
}
*ret_val = NULL;
if (!amd::RuntimeObject::isValidHandle(object)) {
return CL_INVALID_OBJECT_AMD;
}
if (!amd::ObjectMetadata::check(key)) {
return CL_INVALID_KEY_AMD;
}
if (!amd::RuntimeObject::isValidHandle(object)) {
return CL_INVALID_OBJECT_AMD;
}
if (!amd::ObjectMetadata::check(key)) {
return CL_INVALID_KEY_AMD;
}
amd::ObjectMetadata& metadata =
amd::RuntimeObject::fromHandle<amd::RuntimeObject>(object)->metadata();
amd::ObjectMetadata& metadata =
amd::RuntimeObject::fromHandle<amd::RuntimeObject>(object)->metadata();
void* value = metadata.getValueForKey(key);
if (value == NULL) {
return CL_INVALID_KEY_AMD;
}
void* value = metadata.getValueForKey(key);
if (value == NULL) {
return CL_INVALID_KEY_AMD;
}
*ret_val = value;
return CL_SUCCESS;
*ret_val = value;
return CL_SUCCESS;
}
RUNTIME_EXIT
RUNTIME_ENTRY(cl_int, clObjectSetValueForKeyAMD, (
void * object,
cl_key_amd key,
void * value))
{
if (!amd::RuntimeObject::isValidHandle(object)) {
return CL_INVALID_OBJECT_AMD;
}
if (!amd::ObjectMetadata::check(key)) {
return CL_INVALID_KEY_AMD;
}
if (value == NULL) {
return CL_INVALID_VALUE;
}
RUNTIME_ENTRY(cl_int, clObjectSetValueForKeyAMD, (void* object, cl_key_amd key, void* value)) {
if (!amd::RuntimeObject::isValidHandle(object)) {
return CL_INVALID_OBJECT_AMD;
}
if (!amd::ObjectMetadata::check(key)) {
return CL_INVALID_KEY_AMD;
}
if (value == NULL) {
return CL_INVALID_VALUE;
}
amd::ObjectMetadata& metadata =
amd::RuntimeObject::fromHandle<amd::RuntimeObject>(object)->metadata();
amd::ObjectMetadata& metadata =
amd::RuntimeObject::fromHandle<amd::RuntimeObject>(object)->metadata();
metadata.setValueForKey(key, value);
return CL_SUCCESS;
metadata.setValueForKey(key, value);
return CL_SUCCESS;
}
RUNTIME_EXIT
+70 -82
Wyświetl plik
@@ -57,67 +57,62 @@
*
* \version 2.0r19
*/
RUNTIME_ENTRY_RET(cl_mem, clCreatePipe, (
cl_context context,
cl_mem_flags flags,
cl_uint pipe_packet_size,
cl_uint pipe_max_packets,
const cl_pipe_properties *properties,
cl_int *errcode_ret))
{
if (!is_valid(context)) {
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
return NULL;
RUNTIME_ENTRY_RET(cl_mem, clCreatePipe,
(cl_context context, cl_mem_flags flags, cl_uint pipe_packet_size,
cl_uint pipe_max_packets, const cl_pipe_properties* properties,
cl_int* errcode_ret)) {
if (!is_valid(context)) {
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
return NULL;
}
// check flags for validity
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
cl_bitfield temp = flags
& (CL_MEM_READ_WRITE | CL_MEM_WRITE_ONLY | CL_MEM_READ_ONLY | CL_MEM_HOST_NO_ACCESS);
// 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;
}
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;
}
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;
}
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();
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 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);
*not_null(errcode_ret) = CL_SUCCESS;
return as_cl(mem);
}
RUNTIME_EXIT
@@ -141,44 +136,37 @@ RUNTIME_EXIT
* - 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
* 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.
*
* \version 2.0r19
*/
RUNTIME_ENTRY(cl_int, clGetPipeInfo, (
cl_mem memobj,
cl_image_info param_name,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret))
{
if (!is_valid(memobj)) {
return CL_INVALID_MEM_OBJECT;
}
RUNTIME_ENTRY(cl_int, clGetPipeInfo,
(cl_mem memobj, cl_image_info param_name, size_t param_value_size, void* param_value,
size_t* param_value_size_ret)) {
if (!is_valid(memobj)) {
return CL_INVALID_MEM_OBJECT;
}
amd::Pipe* pipe = as_amd(memobj)->asPipe();
if (pipe == NULL) {
return CL_INVALID_MEM_OBJECT;
}
amd::Pipe* pipe = as_amd(memobj)->asPipe();
if (pipe == NULL) {
return CL_INVALID_MEM_OBJECT;
}
switch (param_name) {
switch (param_name) {
case CL_PIPE_PACKET_SIZE: {
cl_uint packetSize = pipe->getPacketSize();
return amd::clGetInfo(
packetSize, param_value_size, param_value, param_value_size_ret);
cl_uint packetSize = pipe->getPacketSize();
return amd::clGetInfo(packetSize, param_value_size, param_value, param_value_size_ret);
}
case CL_PIPE_MAX_PACKETS: {
cl_uint count = pipe->getMaxNumPackets();
return amd::clGetInfo(
count, param_value_size, param_value, param_value_size_ret);
cl_uint count = pipe->getMaxNumPackets();
return amd::clGetInfo(count, param_value_size, param_value, param_value_size_ret);
}
default:
break;
}
return CL_INVALID_VALUE;
break;
}
return CL_INVALID_VALUE;
}
RUNTIME_EXIT
@@ -13,12 +13,11 @@
*
*/
RUNTIME_ENTRY(cl_int, clUnloadPlatformAMD, (cl_platform_id platform))
{
if (AMD_PLATFORM == platform) {
amd::Runtime::tearDown();
}
return CL_SUCCESS;
RUNTIME_ENTRY(cl_int, clUnloadPlatformAMD, (cl_platform_id platform)) {
if (AMD_PLATFORM == platform) {
amd::Runtime::tearDown();
}
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -103,15 +103,15 @@ extern "C" {
/*! \brief Unloads the specified platform, handling all required cleanup.
*
* @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
* @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
* capture working). It should handle ICD unregistration as well.
*/
extern CL_API_ENTRY cl_int CL_API_CALL
clUnloadPlatformAMD(cl_platform_id platform) CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_int CL_API_CALL clUnloadPlatformAMD(cl_platform_id platform)
CL_API_SUFFIX__VERSION_1_0;
#ifdef __cplusplus
} /*extern "C"*/
#endif /*__cplusplus*/
#endif /*__CL_AMD_PROFILE_H*/
#endif /*__CL_AMD_PROFILE_H*/
+164 -194
Wyświetl plik
@@ -38,46 +38,40 @@
*
* \return Created perfcounter object
*/
RUNTIME_ENTRY_RET(cl_perfcounter_amd, clCreatePerfCounterAMD, (
cl_device_id device,
cl_perfcounter_property* properties,
cl_int* errcode_ret))
{
// Make sure we have a valid device object
if (!is_valid(device)) {
*not_null(errcode_ret) = CL_INVALID_DEVICE;
return NULL;
RUNTIME_ENTRY_RET(cl_perfcounter_amd, clCreatePerfCounterAMD,
(cl_device_id device, cl_perfcounter_property* properties, cl_int* errcode_ret)) {
// Make sure we have a valid device object
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
if (NULL == properties) {
return NULL;
}
// Create the device perf counter
amd::PerfCounter* perfCounter = new amd::PerfCounter(*as_amd(device), perfProperties);
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;
}
}
if (perfCounter == NULL) {
*not_null(errcode_ret) = CL_INVALID_OPERATION;
return NULL;
}
// Create the device perf counter
amd::PerfCounter* 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);
*not_null(errcode_ret) = CL_SUCCESS;
return as_cl(perfCounter);
}
RUNTIME_EXIT
@@ -89,14 +83,12 @@ RUNTIME_EXIT
* - CL_SUCCESS if the function is executed successfully.
* - CL_INVALID_OPERATION if we failed to release the object
*/
RUNTIME_ENTRY(cl_int, clReleasePerfCounterAMD, (
cl_perfcounter_amd perf_counter))
{
if (!is_valid(perf_counter)) {
return CL_INVALID_OPERATION;
}
as_amd(perf_counter)->release();
return CL_SUCCESS;
RUNTIME_ENTRY(cl_int, clReleasePerfCounterAMD, (cl_perfcounter_amd perf_counter)) {
if (!is_valid(perf_counter)) {
return CL_INVALID_OPERATION;
}
as_amd(perf_counter)->release();
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -108,14 +100,12 @@ RUNTIME_EXIT
* - CL_SUCCESS if the function is executed successfully.
* - CL_INVALID_OPERATION if we failed to release the object
*/
RUNTIME_ENTRY(cl_int, clRetainPerfCounterAMD, (
cl_perfcounter_amd perf_counter))
{
if (!is_valid(perf_counter)) {
return CL_INVALID_OPERATION;
}
as_amd(perf_counter)->retain();
return CL_SUCCESS;
RUNTIME_ENTRY(cl_int, clRetainPerfCounterAMD, (cl_perfcounter_amd perf_counter)) {
if (!is_valid(perf_counter)) {
return CL_INVALID_OPERATION;
}
as_amd(perf_counter)->retain();
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -151,64 +141,58 @@ RUNTIME_EXIT
* - CL_INVALID_OPERATION if we failed to enqueue the begin operation
* - CL_INVALID_COMMAND_QUEUE if the queue is
*/
RUNTIME_ENTRY(cl_int, clEnqueueBeginPerfCounterAMD, (
cl_command_queue command_queue,
cl_uint num_perf_counters,
cl_perfcounter_amd* perf_counters,
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;
RUNTIME_ENTRY(cl_int, clEnqueueBeginPerfCounterAMD,
(cl_command_queue command_queue, cl_uint num_perf_counters,
cl_perfcounter_amd* perf_counters, 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 ((num_perf_counters == 0) || (perf_counters == NULL)) {
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)) {
return CL_INVALID_OPERATION;
}
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::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
if (NULL == hostQueue) {
return CL_INVALID_COMMAND_QUEUE;
}
// 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;
}
amd::PerfCounterCommand::PerfCounterList counters;
// Submit the command to the device
command->enqueue();
// 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;
}
}
*not_null(event) = as_cl(&command->event());
if (event == NULL) {
command->release();
}
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 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;
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -243,64 +227,58 @@ RUNTIME_EXIT
* - CL_SUCCESS if the function is executed successfully.
* - CL_INVALID_OPERATION if we failed to enqueue the end operation
*/
RUNTIME_ENTRY(cl_int, clEnqueueEndPerfCounterAMD, (
cl_command_queue command_queue,
cl_uint num_perf_counters,
cl_perfcounter_amd* perf_counters,
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;
RUNTIME_ENTRY(cl_int, clEnqueueEndPerfCounterAMD,
(cl_command_queue command_queue, cl_uint num_perf_counters,
cl_perfcounter_amd* perf_counters, 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 ((num_perf_counters == 0) || (perf_counters == NULL)) {
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)) {
return CL_INVALID_OPERATION;
}
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::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
if (NULL == hostQueue) {
return CL_INVALID_COMMAND_QUEUE;
}
// 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;
}
amd::PerfCounterCommand::PerfCounterList counters;
// Submit the command to the device
command->enqueue();
// 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;
}
}
*not_null(event) = as_cl(&command->event());
if (event == NULL) {
command->release();
}
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 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;
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -323,57 +301,49 @@ RUNTIME_EXIT
* - CL_PROFILING_INFO_NOT_AVAILABLE if event isn't finished.
* - CL_INVALID_OPERATION if we failed to get the data
*/
RUNTIME_ENTRY(cl_int, clGetPerfCounterInfoAMD, (
cl_perfcounter_amd perf_counter,
cl_perfcounter_info param_name,
size_t param_value_size,
void* param_value,
size_t* param_value_size_ret))
{
// Check if we have a valid performance counter
if (!is_valid(perf_counter)) {
return CL_INVALID_OPERATION;
}
RUNTIME_ENTRY(cl_int, clGetPerfCounterInfoAMD,
(cl_perfcounter_amd perf_counter, cl_perfcounter_info param_name,
size_t param_value_size, void* param_value, size_t* param_value_size_ret)) {
// 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
const device::PerfCounter* devCounter =
as_amd(perf_counter)->getDeviceCounter();
// Find the kernel, associated with the specified device
const device::PerfCounter* devCounter = as_amd(perf_counter)->getDeviceCounter();
// Make sure we found a valid performance counter
if (devCounter == NULL) {
return CL_INVALID_OPERATION;
}
// Make sure we found a valid performance counter
if (devCounter == NULL) {
return CL_INVALID_OPERATION;
}
// Get the corresponded parameters
switch (param_name) {
// Get the corresponded parameters
switch (param_name) {
case CL_PERFCOUNTER_REFERENCE_COUNT: {
cl_uint count = as_amd(perf_counter)->referenceCount();
// Return the reference counter
return amd::clGetInfo(
count, param_value_size, param_value, param_value_size_ret);
cl_uint count = as_amd(perf_counter)->referenceCount();
// Return the reference counter
return amd::clGetInfo(count, param_value_size, param_value, param_value_size_ret);
}
case CL_PERFCOUNTER_GPU_BLOCK_INDEX:
case CL_PERFCOUNTER_GPU_COUNTER_INDEX:
case CL_PERFCOUNTER_GPU_EVENT_INDEX: {
cl_ulong data = devCounter->getInfo(param_name);
// Return the device performance counter information
return amd::clGetInfo(data,
param_value_size, param_value, param_value_size_ret);
cl_ulong data = devCounter->getInfo(param_name);
// Return the device performance counter information
return amd::clGetInfo(data, param_value_size, param_value, param_value_size_ret);
}
case CL_PERFCOUNTER_DATA: {
cl_ulong data = devCounter->getInfo(param_name);
if (static_cast<cl_ulong>(0xffffffffffffffffULL) == data) {
return CL_PROFILING_INFO_NOT_AVAILABLE;
}
// Return the device performance counter result
return amd::clGetInfo(data,
param_value_size, param_value, param_value_size_ret);
cl_ulong data = devCounter->getInfo(param_name);
if (static_cast<cl_ulong>(0xffffffffffffffffULL) == data) {
return CL_PROFILING_INFO_NOT_AVAILABLE;
}
// Return the device performance counter result
return amd::clGetInfo(data, param_value_size, param_value, param_value_size_ret);
}
default:
return CL_INVALID_VALUE;
}
return CL_INVALID_VALUE;
}
return CL_SUCCESS;
return CL_SUCCESS;
}
RUNTIME_EXIT
+31 -51
Wyświetl plik
@@ -99,20 +99,19 @@ jurisdiction and venue of these courts.
extern "C" {
#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_uint cl_perfcounter_info;
/* cl_perfcounter_info */
enum PerfcounterInfo
{
CL_PERFCOUNTER_NONE = 0x0,
CL_PERFCOUNTER_REFERENCE_COUNT = 0x1,
CL_PERFCOUNTER_DATA = 0x2,
CL_PERFCOUNTER_GPU_BLOCK_INDEX = 0x3,
CL_PERFCOUNTER_GPU_COUNTER_INDEX = 0x4,
CL_PERFCOUNTER_GPU_EVENT_INDEX = 0x5,
CL_PERFCOUNTER_LAST
enum PerfcounterInfo {
CL_PERFCOUNTER_NONE = 0x0,
CL_PERFCOUNTER_REFERENCE_COUNT = 0x1,
CL_PERFCOUNTER_DATA = 0x2,
CL_PERFCOUNTER_GPU_BLOCK_INDEX = 0x3,
CL_PERFCOUNTER_GPU_COUNTER_INDEX = 0x4,
CL_PERFCOUNTER_GPU_EVENT_INDEX = 0x5,
CL_PERFCOUNTER_LAST
};
/*! \brief Creates a new HW performance counter
@@ -129,12 +128,9 @@ enum PerfcounterInfo
*
* \return the created perfcounter object
*/
extern CL_API_ENTRY cl_perfcounter_amd CL_API_CALL
clCreatePerfCounterAMD(
cl_device_id /* device */,
cl_perfcounter_property* /* properties */,
cl_int* /* errcode_ret */
) CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_perfcounter_amd CL_API_CALL clCreatePerfCounterAMD(
cl_device_id /* device */, cl_perfcounter_property* /* properties */, cl_int* /* errcode_ret */
) CL_API_SUFFIX__VERSION_1_0;
/*! \brief Destroy a performance counter object.
*
@@ -144,10 +140,8 @@ clCreatePerfCounterAMD(
* - CL_SUCCESS if the function is executed successfully.
* - CL_INVALID_OPERATION if we failed to release the object
*/
extern CL_API_ENTRY cl_int CL_API_CALL
clReleasePerfCounterAMD(
cl_perfcounter_amd /* perf_counter */
) CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_int CL_API_CALL clReleasePerfCounterAMD(cl_perfcounter_amd /* perf_counter */
) CL_API_SUFFIX__VERSION_1_0;
/*! \brief Increments the perfcounter object reference count.
*
@@ -157,10 +151,8 @@ clReleasePerfCounterAMD(
* - CL_SUCCESS if the function is executed successfully.
* - CL_INVALID_OPERATION if we failed to release the object
*/
extern CL_API_ENTRY cl_int CL_API_CALL
clRetainPerfCounterAMD(
cl_perfcounter_amd /* perf_counter */
) CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_int CL_API_CALL clRetainPerfCounterAMD(cl_perfcounter_amd /* perf_counter */
) CL_API_SUFFIX__VERSION_1_0;
/*! \brief Enqueues the begin command for the specified counters.
*
@@ -174,15 +166,11 @@ clRetainPerfCounterAMD(
* - CL_SUCCESS if the function is executed successfully.
* - CL_INVALID_OPERATION if we failed to enqueue the begin operation
*/
extern CL_API_ENTRY cl_int CL_API_CALL
clEnqueueBeginPerfCounterAMD(
cl_command_queue /* command_queue */,
cl_uint /* num_perf_counters */,
cl_perfcounter_amd* /* perf_counters */,
cl_uint /* num_events_in_wait_list */,
const cl_event* /* event_wait_list */,
cl_event* /* event */
) CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueBeginPerfCounterAMD(
cl_command_queue /* command_queue */, cl_uint /* num_perf_counters */,
cl_perfcounter_amd* /* perf_counters */, 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.
*
@@ -198,15 +186,11 @@ clEnqueueBeginPerfCounterAMD(
* - CL_SUCCESS if the function is executed successfully.
* - CL_INVALID_OPERATION if we failed to enqueue the end operation
*/
extern CL_API_ENTRY cl_int CL_API_CALL
clEnqueueEndPerfCounterAMD(
cl_command_queue /* command_queue */,
cl_uint /* num_perf_counters */,
cl_perfcounter_amd* /* perf_counters */,
cl_uint /* num_events_in_wait_list */,
const cl_event* /* event_wait_list */,
cl_event* /* event */
) CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueEndPerfCounterAMD(
cl_command_queue /* command_queue */, cl_uint /* num_perf_counters */,
cl_perfcounter_amd* /* perf_counters */, 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.
*
@@ -231,17 +215,13 @@ clEnqueueEndPerfCounterAMD(
* - CL_PROFILING_INFO_NOT_AVAILABLE if event isn't finished.
* - CL_INVALID_OPERATION if we failed to get the data
*/
extern CL_API_ENTRY cl_int CL_API_CALL
clGetPerfCounterInfoAMD(
cl_perfcounter_amd /* perf_counter */,
cl_perfcounter_info /* param_name */,
size_t /* param_value_size */,
void* /* param_value */,
size_t* /* param_value_size_ret */
) CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_int CL_API_CALL clGetPerfCounterInfoAMD(
cl_perfcounter_amd /* perf_counter */, cl_perfcounter_info /* param_name */,
size_t /* param_value_size */, void* /* param_value */, size_t* /* param_value_size_ret */
) CL_API_SUFFIX__VERSION_1_0;
#ifdef __cplusplus
} /*extern "C"*/
#endif /*__cplusplus*/
#endif /*__CL_PROFILE_AMD_H*/
#endif /*__CL_PROFILE_AMD_H*/
Plik diff jest za duży Load Diff
+159 -184
Wyświetl plik
@@ -52,138 +52,133 @@
*
* \version 2.0r19
*/
RUNTIME_ENTRY_RET(cl_sampler, clCreateSamplerWithProperties, (
cl_context context,
const cl_sampler_properties *sampler_properties,
cl_int *errcode_ret))
{
if(!is_valid(context)) {
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
LogWarning("invalid parameter \"context\"");
return (cl_sampler) 0;
}
RUNTIME_ENTRY_RET(cl_sampler, clCreateSamplerWithProperties,
(cl_context context, const cl_sampler_properties* sampler_properties,
cl_int* errcode_ret)) {
if (!is_valid(context)) {
*not_null(errcode_ret) = CL_INVALID_CONTEXT;
LogWarning("invalid parameter \"context\"");
return (cl_sampler)0;
}
cl_bool normalizedCoords = CL_TRUE;
cl_addressing_mode addressingMode = CL_ADDRESS_CLAMP;
cl_filter_mode filterMode = CL_FILTER_NEAREST;
cl_bool normalizedCoords = CL_TRUE;
cl_addressing_mode addressingMode = CL_ADDRESS_CLAMP;
cl_filter_mode filterMode = CL_FILTER_NEAREST;
#ifndef CL_FILTER_NONE
#define CL_FILTER_NONE 0x1142
#endif
cl_filter_mode mipFilterMode = CL_FILTER_NONE;
float minLod = 0.f;
float maxLod = CL_MAXFLOAT;
cl_filter_mode mipFilterMode = CL_FILTER_NONE;
float minLod = 0.f;
float maxLod = CL_MAXFLOAT;
const struct SamplerProperty {
cl_sampler_properties name;
union {
cl_sampler_properties raw;
cl_bool normalizedCoords;
cl_addressing_mode addressingMode;
cl_filter_mode filterMode;
cl_float lod;
} value;
} *p = reinterpret_cast<const SamplerProperty*>(sampler_properties);
const struct SamplerProperty {
cl_sampler_properties name;
union {
cl_sampler_properties raw;
cl_bool normalizedCoords;
cl_addressing_mode addressingMode;
cl_filter_mode filterMode;
cl_float lod;
} value;
}* p = reinterpret_cast<const SamplerProperty*>(sampler_properties);
if (p != NULL) while(p->name != 0) {
switch(p->name) {
if (p != NULL)
while (p->name != 0) {
switch (p->name) {
case CL_SAMPLER_NORMALIZED_COORDS:
normalizedCoords = p->value.normalizedCoords;
break;
normalizedCoords = p->value.normalizedCoords;
break;
case CL_SAMPLER_ADDRESSING_MODE:
addressingMode = p->value.addressingMode;
break;
addressingMode = p->value.addressingMode;
break;
case CL_SAMPLER_FILTER_MODE:
filterMode = p->value.filterMode;
break;
filterMode = p->value.filterMode;
break;
case CL_SAMPLER_MIP_FILTER_MODE:
mipFilterMode = p->value.filterMode;
break;
mipFilterMode = p->value.filterMode;
break;
case CL_SAMPLER_LOD_MIN:
minLod = p->value.lod;
break;
minLod = p->value.lod;
break;
case CL_SAMPLER_LOD_MAX:
maxLod = p->value.lod;
break;
maxLod = p->value.lod;
break;
default:
*not_null(errcode_ret) = CL_INVALID_VALUE;
LogWarning("invalid property name");
return (cl_sampler) 0;
}
++p;
*not_null(errcode_ret) = CL_INVALID_VALUE;
LogWarning("invalid property name");
return (cl_sampler)0;
}
++p;
}
// Check sampler validity
// Check addressing mode
switch (addressingMode) {
case CL_ADDRESS_NONE:
case CL_ADDRESS_CLAMP_TO_EDGE:
case CL_ADDRESS_CLAMP:
break;
case CL_ADDRESS_REPEAT:
if (!normalizedCoords) {
// repeat mode cannot be used with unnormalized coordinates
*not_null(errcode_ret) = CL_INVALID_VALUE;
LogWarning("invalid combination for sampler");
return (cl_sampler) 0;
}
break;
case CL_ADDRESS_MIRRORED_REPEAT:
if (!normalizedCoords) {
// repeat mode cannot be used with unnormalized coordinates
*not_null(errcode_ret) = CL_INVALID_VALUE;
LogWarning("invalid combination for sampler");
return (cl_sampler) 0;
}
break;
default:
*not_null(errcode_ret) = CL_INVALID_VALUE;
LogWarning("invalid addressing mode");
return (cl_sampler) 0;
}
// Check filter mode
switch (filterMode) {
case CL_FILTER_NEAREST:
case CL_FILTER_LINEAR:
break;
default:
*not_null(errcode_ret) = CL_INVALID_VALUE;
LogWarning("invalid filter mode");
return (cl_sampler) 0;
}
switch (mipFilterMode) {
case CL_FILTER_NONE:
case CL_FILTER_NEAREST:
case CL_FILTER_LINEAR:
break;
default:
*not_null(errcode_ret) = CL_INVALID_VALUE;
LogWarning("invalid filter mode");
return (cl_sampler) 0;
}
// Create instance of Sampler
amd::Sampler* sampler = new amd::Sampler(
*as_amd(context),
normalizedCoords == CL_TRUE, // To get rid of VS warning C4800
addressingMode,
filterMode,
mipFilterMode,
minLod,
maxLod);
if (!sampler) {
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
LogWarning("not enough host memory");
return (cl_sampler) 0;
}
// Check sampler validity
// Check addressing mode
switch (addressingMode) {
case CL_ADDRESS_NONE:
case CL_ADDRESS_CLAMP_TO_EDGE:
case CL_ADDRESS_CLAMP:
break;
case CL_ADDRESS_REPEAT:
if (!normalizedCoords) {
// repeat mode cannot be used with unnormalized coordinates
*not_null(errcode_ret) = CL_INVALID_VALUE;
LogWarning("invalid combination for sampler");
return (cl_sampler)0;
}
break;
case CL_ADDRESS_MIRRORED_REPEAT:
if (!normalizedCoords) {
// repeat mode cannot be used with unnormalized coordinates
*not_null(errcode_ret) = CL_INVALID_VALUE;
LogWarning("invalid combination for sampler");
return (cl_sampler)0;
}
break;
default:
*not_null(errcode_ret) = CL_INVALID_VALUE;
LogWarning("invalid addressing mode");
return (cl_sampler)0;
}
// Check filter mode
switch (filterMode) {
case CL_FILTER_NEAREST:
case CL_FILTER_LINEAR:
break;
default:
*not_null(errcode_ret) = CL_INVALID_VALUE;
LogWarning("invalid filter mode");
return (cl_sampler)0;
}
switch (mipFilterMode) {
case CL_FILTER_NONE:
case CL_FILTER_NEAREST:
case CL_FILTER_LINEAR:
break;
default:
*not_null(errcode_ret) = CL_INVALID_VALUE;
LogWarning("invalid filter mode");
return (cl_sampler)0;
}
// Create instance of Sampler
amd::Sampler* sampler =
new amd::Sampler(*as_amd(context),
normalizedCoords == CL_TRUE, // To get rid of VS warning C4800
addressingMode, filterMode, mipFilterMode, minLod, maxLod);
if (!sampler) {
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
LogWarning("not enough host memory");
return (cl_sampler)0;
}
if (!sampler->create()) {
delete sampler;
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
LogWarning("Runtime failed sampler creation!");
return as_cl<amd::Sampler>(0);
}
if (!sampler->create()) {
delete sampler;
*not_null(errcode_ret) = CL_OUT_OF_HOST_MEMORY;
LogWarning("Runtime failed sampler creation!");
return as_cl<amd::Sampler>(0);
}
*not_null(errcode_ret) = CL_SUCCESS;
return as_cl<amd::Sampler>(sampler);
*not_null(errcode_ret) = CL_SUCCESS;
return as_cl<amd::Sampler>(sampler);
}
RUNTIME_EXIT
@@ -219,22 +214,17 @@ RUNTIME_EXIT
*
* \version 1.0r33
*/
RUNTIME_ENTRY_RET(cl_sampler, clCreateSampler, (
cl_context context,
cl_bool normalized_coords,
cl_addressing_mode addressing_mode,
cl_filter_mode filter_mode,
cl_int *errcode_ret))
{
const cl_sampler_properties sprops[] = {
CL_SAMPLER_NORMALIZED_COORDS,
static_cast<cl_sampler_properties>(normalized_coords),
CL_SAMPLER_ADDRESSING_MODE,
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_ENTRY_RET(cl_sampler, clCreateSampler, (cl_context context, cl_bool normalized_coords,
cl_addressing_mode addressing_mode,
cl_filter_mode filter_mode, cl_int* errcode_ret)) {
const cl_sampler_properties sprops[] = {CL_SAMPLER_NORMALIZED_COORDS,
static_cast<cl_sampler_properties>(normalized_coords),
CL_SAMPLER_ADDRESSING_MODE,
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
@@ -247,13 +237,12 @@ RUNTIME_EXIT
*
* \version 1.0r33
*/
RUNTIME_ENTRY(cl_int, clRetainSampler, (cl_sampler sampler))
{
if (!is_valid(sampler)) {
return CL_INVALID_SAMPLER;
}
as_amd(sampler)->retain();
return CL_SUCCESS;
RUNTIME_ENTRY(cl_int, clRetainSampler, (cl_sampler sampler)) {
if (!is_valid(sampler)) {
return CL_INVALID_SAMPLER;
}
as_amd(sampler)->retain();
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -268,13 +257,12 @@ RUNTIME_EXIT
*
* \version 1.0r33
*/
RUNTIME_ENTRY(cl_int, clReleaseSampler, (cl_sampler sampler))
{
if (!is_valid(sampler)) {
return CL_INVALID_SAMPLER;
}
as_amd(sampler)->release();
return CL_SUCCESS;
RUNTIME_ENTRY(cl_int, clReleaseSampler, (cl_sampler sampler)) {
if (!is_valid(sampler)) {
return CL_INVALID_SAMPLER;
}
as_amd(sampler)->release();
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -302,64 +290,51 @@ RUNTIME_EXIT
*
* \version 1.0r33
*/
RUNTIME_ENTRY(cl_int, clGetSamplerInfo, (
cl_sampler sampler,
cl_sampler_info param_name,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret))
{
if (!is_valid(sampler)) {
return CL_INVALID_SAMPLER;
}
RUNTIME_ENTRY(cl_int, clGetSamplerInfo,
(cl_sampler sampler, cl_sampler_info param_name, size_t param_value_size,
void* param_value, 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: {
cl_uint count = as_amd(sampler)->referenceCount();
return amd::clGetInfo(
count, param_value_size, param_value, param_value_size_ret);
cl_uint count = as_amd(sampler)->referenceCount();
return amd::clGetInfo(count, param_value_size, param_value, param_value_size_ret);
}
case CL_SAMPLER_CONTEXT: {
cl_context context = as_cl(&as_amd(sampler)->context());
return amd::clGetInfo(
context, param_value_size, param_value, param_value_size_ret);
cl_context context = as_cl(&as_amd(sampler)->context());
return amd::clGetInfo(context, param_value_size, param_value, param_value_size_ret);
}
case CL_SAMPLER_ADDRESSING_MODE: {
cl_addressing_mode addressing = as_amd(sampler)->addressingMode();
return amd::clGetInfo(
addressing, param_value_size, param_value, param_value_size_ret);
cl_addressing_mode addressing = as_amd(sampler)->addressingMode();
return amd::clGetInfo(addressing, param_value_size, param_value, param_value_size_ret);
}
case CL_SAMPLER_FILTER_MODE: {
cl_filter_mode filter = as_amd(sampler)->filterMode();
return amd::clGetInfo(
filter, param_value_size, param_value, param_value_size_ret);
cl_filter_mode filter = as_amd(sampler)->filterMode();
return amd::clGetInfo(filter, param_value_size, param_value, param_value_size_ret);
}
case CL_SAMPLER_NORMALIZED_COORDS: {
cl_bool normalized = as_amd(sampler)->normalizedCoords();
return amd::clGetInfo(
normalized, param_value_size, param_value, param_value_size_ret);
cl_bool normalized = as_amd(sampler)->normalizedCoords();
return amd::clGetInfo(normalized, param_value_size, param_value, param_value_size_ret);
}
case CL_SAMPLER_MIP_FILTER_MODE: {
cl_filter_mode mipFilter = as_amd(sampler)->mipFilter();
return amd::clGetInfo(
mipFilter, param_value_size, param_value, param_value_size_ret);
cl_filter_mode mipFilter = as_amd(sampler)->mipFilter();
return amd::clGetInfo(mipFilter, param_value_size, param_value, param_value_size_ret);
}
case CL_SAMPLER_LOD_MIN: {
cl_float minLod = as_amd(sampler)->minLod();
return amd::clGetInfo(
minLod, param_value_size, param_value, param_value_size_ret);
cl_float minLod = as_amd(sampler)->minLod();
return amd::clGetInfo(minLod, param_value_size, param_value, param_value_size_ret);
}
case CL_SAMPLER_LOD_MAX: {
cl_float maxLod = as_amd(sampler)->maxLod();
return amd::clGetInfo(
maxLod, param_value_size, param_value, param_value_size_ret);
cl_float maxLod = as_amd(sampler)->maxLod();
return amd::clGetInfo(maxLod, param_value_size, param_value, param_value_size_ret);
}
default:
break;
}
break;
}
return CL_INVALID_VALUE;
return CL_INVALID_VALUE;
}
RUNTIME_EXIT
+190 -228
Wyświetl plik
@@ -6,254 +6,216 @@
#include <cstring>
RUNTIME_ENTRY(cl_int, clEnqueueWaitSignalAMD, (
cl_command_queue command_queue,
cl_mem mem_object,
cl_uint value,
cl_uint num_events,
const cl_event * event_wait_list,
cl_event * event) )
RUNTIME_ENTRY(cl_int, clEnqueueWaitSignalAMD,
(cl_command_queue command_queue, cl_mem mem_object, cl_uint value, 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_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)) {
return CL_INVALID_COMMAND_QUEUE;
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;
}
if (!is_valid(mem_object)) {
return CL_INVALID_MEM_OBJECT;
}
amd::Buffer* buffer = as_amd(mem_object)->asBuffer();
amd::Buffer* buffer = as_amd(mem_objects[i])->asBuffer();
if (buffer == NULL) {
return CL_INVALID_MEM_OBJECT;
return CL_INVALID_MEM_OBJECT;
}
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()) {
return CL_INVALID_CONTEXT;
return CL_INVALID_CONTEXT;
}
amd::Command::EventWaitList eventWaitList;
cl_int err = amd::clSetEventWaitList( eventWaitList,
hostQueue.context(),
num_events,
event_wait_list);
memObjects.push_back(buffer);
}
if (err != CL_SUCCESS) {
return err;
}
amd::Command::EventWaitList eventWaitList;
cl_int err =
amd::clSetEventWaitList(eventWaitList, hostQueue.context(), num_events, event_wait_list);
amd::SignalCommand * command = new amd::SignalCommand (
hostQueue,
CL_COMMAND_WAIT_SIGNAL_AMD,
eventWaitList,
*buffer,
value);
if (err != CL_SUCCESS) {
return err;
}
if (command == NULL) {
return CL_OUT_OF_HOST_MEMORY;
}
amd::MakeBuffersResidentCommand* command = new amd::MakeBuffersResidentCommand(
hostQueue, CL_COMMAND_MAKE_BUFFERS_RESIDENT_AMD, eventWaitList, memObjects, bus_addresses);
// Make sure we have memory for the command execution
if (!command->validateMemory()) {
delete command;
return CL_OUT_OF_RESOURCES;
}
if (command == NULL) {
return CL_OUT_OF_HOST_MEMORY;
}
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());
if (event == NULL) {
command->release();
}
command->enqueue();
return CL_SUCCESS;
if (blocking_make_resident) {
command->awaitCompletion();
}
}
RUNTIME_EXIT
*not_null(event) = as_cl(&command->event());
if (event == NULL) {
command->release();
}
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;
return CL_SUCCESS;
}
RUNTIME_EXIT
+10 -27
Wyświetl plik
@@ -8,37 +8,20 @@ extern "C" {
#endif /*__cplusplus*/
extern CL_API_ENTRY cl_int CL_API_CALL
clEnqueueWaitSignalAMD(
cl_command_queue command_queue,
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 clEnqueueWaitSignalAMD(
cl_command_queue command_queue, 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
clEnqueueWriteSignalAMD(
cl_command_queue command_queue,
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 clEnqueueWriteSignalAMD(
cl_command_queue command_queue, 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
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_list,
cl_event * event) CL_EXT_SUFFIX__VERSION_1_2;
extern CL_API_ENTRY cl_int CL_API_CALL 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_list, cl_event* event) CL_EXT_SUFFIX__VERSION_1_2;
#ifdef __cplusplus
@@ -102,12 +102,12 @@ jurisdiction and venue of these courts.
extern "C" {
#endif /* __cplusplus */
/* cl_device_info */
#define CL_DEVICE_MAX_SEMAPHORES_AMD 0xF050
#define CL_DEVICE_MAX_SEMAPHORE_SIZE_AMD 0xF051
/* cl_device_info */
#define CL_DEVICE_MAX_SEMAPHORES_AMD 0xF050
#define CL_DEVICE_MAX_SEMAPHORE_SIZE_AMD 0xF051
/* cl_kernel_work_group_info */
#define CL_KERNEL_MAX_SEMAPHORE_SIZE_AMD 0xF052
/* cl_kernel_work_group_info */
#define CL_KERNEL_MAX_SEMAPHORE_SIZE_AMD 0xF052
#ifdef __cplusplus
}
Plik diff jest za duży Load Diff
@@ -31,27 +31,24 @@
*
* \return Created cl_threadtrace_amd object
*/
RUNTIME_ENTRY_RET(cl_threadtrace_amd, clCreateThreadTraceAMD, (
cl_device_id device,
cl_int* errcode_ret))
{
// Make sure we have a valid device object
if (!is_valid(device)) {
*not_null(errcode_ret) = CL_INVALID_DEVICE;
return NULL;
}
RUNTIME_ENTRY_RET(cl_threadtrace_amd, clCreateThreadTraceAMD,
(cl_device_id device, cl_int* errcode_ret)) {
// Make sure we have a valid device object
if (!is_valid(device)) {
*not_null(errcode_ret) = CL_INVALID_DEVICE;
return NULL;
}
// Create the device thread trace object
amd::ThreadTrace* threadTrace =
new amd::ThreadTrace(*as_amd(device));
// Create the device thread trace object
amd::ThreadTrace* threadTrace = new amd::ThreadTrace(*as_amd(device));
if (threadTrace == NULL) {
*not_null(errcode_ret) = CL_INVALID_OPERATION;
return NULL;
}
if (threadTrace == NULL) {
*not_null(errcode_ret) = CL_INVALID_OPERATION;
return NULL;
}
*not_null(errcode_ret) = CL_SUCCESS;
return as_cl(threadTrace);
*not_null(errcode_ret) = CL_SUCCESS;
return as_cl(threadTrace);
}
RUNTIME_EXIT
@@ -63,14 +60,12 @@ RUNTIME_EXIT
// * - CL_SUCCESS if the function is executed successfully.
// * - CL_INVALID_OPERATION if we failed to release the object
// */
RUNTIME_ENTRY(cl_int, clReleaseThreadTraceAMD, (
cl_threadtrace_amd threadTrace))
{
if (!is_valid(threadTrace)) {
return CL_INVALID_OPERATION;
}
as_amd(threadTrace)->release();
return CL_SUCCESS;
RUNTIME_ENTRY(cl_int, clReleaseThreadTraceAMD, (cl_threadtrace_amd threadTrace)) {
if (!is_valid(threadTrace)) {
return CL_INVALID_OPERATION;
}
as_amd(threadTrace)->release();
return CL_SUCCESS;
}
RUNTIME_EXIT
//
@@ -82,14 +77,12 @@ RUNTIME_EXIT
// * - CL_SUCCESS if the function is executed successfully.
// * - CL_INVALID_OPERATION if we failed to release the object
// */
RUNTIME_ENTRY(cl_int, clRetainThreadTraceAMD, (
cl_threadtrace_amd threadTrace))
{
if (!is_valid(threadTrace)) {
return CL_INVALID_OPERATION;
}
as_amd(threadTrace)->retain();
return CL_SUCCESS;
RUNTIME_ENTRY(cl_int, clRetainThreadTraceAMD, (cl_threadtrace_amd threadTrace)) {
if (!is_valid(threadTrace)) {
return CL_INVALID_OPERATION;
}
as_amd(threadTrace)->retain();
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -105,70 +98,71 @@ RUNTIME_EXIT
// * \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 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.
// * - 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
// OpenCL implementation on the host.
// */
RUNTIME_ENTRY(cl_int, clSetThreadTraceParamAMD,(cl_threadtrace_amd thread_trace ,
cl_thread_trace_param config_param ,
cl_uint param_value ))
{
if (!is_valid(thread_trace)) {
return CL_INVALID_OPERATION;
}
switch (config_param) {
RUNTIME_ENTRY(cl_int, clSetThreadTraceParamAMD,
(cl_threadtrace_amd thread_trace, cl_thread_trace_param config_param,
cl_uint param_value)) {
if (!is_valid(thread_trace)) {
return CL_INVALID_OPERATION;
}
switch (config_param) {
case CL_THREAD_TRACE_PARAM_TOKEN_MASK:
if (param_value > CL_THREAD_TRACE_TOKEN_MASK_ALL_SI) {
return CL_INVALID_VALUE;
}
as_amd(thread_trace)->setTokenMask(param_value);
break;
if (param_value > CL_THREAD_TRACE_TOKEN_MASK_ALL_SI) {
return CL_INVALID_VALUE;
}
as_amd(thread_trace)->setTokenMask(param_value);
break;
case CL_THREAD_TRACE_PARAM_REG_MASK:
if (param_value > CL_THREAD_TRACE_REG_MASK_ALL_SI) {
return CL_INVALID_VALUE;
}
as_amd(thread_trace)->setRegMask(param_value);
break;
if (param_value > CL_THREAD_TRACE_REG_MASK_ALL_SI) {
return CL_INVALID_VALUE;
}
as_amd(thread_trace)->setRegMask(param_value);
break;
case CL_THREAD_TRACE_PARAM_VM_ID_MASK:
if (param_value > CL_THREAD_TRACE_VM_ID_MASK_SINGLE_DETAIL) {
return CL_INVALID_VALUE;
}
as_amd(thread_trace)->setVmIdMask(param_value);
break;
if (param_value > CL_THREAD_TRACE_VM_ID_MASK_SINGLE_DETAIL) {
return CL_INVALID_VALUE;
}
as_amd(thread_trace)->setVmIdMask(param_value);
break;
case CL_THREAD_TRACE_PARAM_INSTRUCTION_MASK:
if (param_value > CL_THREAD_TRACE_INST_MASK_IMMEDIATE_CI) {
return CL_INVALID_VALUE;
}
as_amd(thread_trace)->setInstMask(param_value);
break;
if (param_value > CL_THREAD_TRACE_INST_MASK_IMMEDIATE_CI) {
return CL_INVALID_VALUE;
}
as_amd(thread_trace)->setInstMask(param_value);
break;
case CL_THREAD_TRACE_PARAM_COMPUTE_UNIT_TARGET:
as_amd(thread_trace)->setCU(param_value);
break;
as_amd(thread_trace)->setCU(param_value);
break;
case CL_THREAD_TRACE_PARAM_SHADER_ARRAY_TARGET:
as_amd(thread_trace)->setSH(param_value);
break;
as_amd(thread_trace)->setSH(param_value);
break;
case CL_THREAD_TRACE_PARAM_SIMD_MASK:
as_amd(thread_trace)->setSIMD(param_value);
break;
as_amd(thread_trace)->setSIMD(param_value);
break;
case CL_THREAD_TRACE_PARAM_USER_DATA:
as_amd(thread_trace)->setUserData(param_value);
break;
as_amd(thread_trace)->setUserData(param_value);
break;
case CL_THREAD_TRACE_PARAM_CAPTURE_MODE:
if (param_value > CL_THREAD_TRACE_CAPTURE_SELECT_DETAIL) {
return CL_INVALID_VALUE;
}
as_amd(thread_trace)->setCaptureMode(param_value);
break;
if (param_value > CL_THREAD_TRACE_CAPTURE_SELECT_DETAIL) {
return CL_INVALID_VALUE;
}
as_amd(thread_trace)->setCaptureMode(param_value);
break;
case CL_THREAD_TRACE_PARAM_IS_WRAPPED:
as_amd(thread_trace)->setIsWrapped(true);
break;
as_amd(thread_trace)->setIsWrapped(true);
break;
case CL_THREAD_TRACE_PARAM_RANDOM_SEED:
as_amd(thread_trace)->setRandomSeed(param_value);
break;
}
return CL_SUCCESS;
as_amd(thread_trace)->setRandomSeed(param_value);
break;
}
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -195,66 +189,59 @@ RUNTIME_EXIT
* - CL_SUCCESS if the function is executed successfully.
*
*/
RUNTIME_ENTRY(cl_int, clGetThreadTraceInfoAMD, (
cl_threadtrace_amd thread_trace /* threadTrace */,
cl_threadtrace_info thread_trace_info_param,
size_t param_value_size,
void* param_value,
size_t* param_value_size_ret))
{
if (!is_valid(thread_trace)) {
RUNTIME_ENTRY(cl_int, clGetThreadTraceInfoAMD,
(cl_threadtrace_amd thread_trace /* threadTrace */,
cl_threadtrace_info thread_trace_info_param, size_t param_value_size,
void* param_value, size_t* param_value_size_ret)) {
if (!is_valid(thread_trace)) {
return CL_INVALID_OPERATION;
}
// 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;
}
}
// Find the thread trace object, associated with the specified device
const device::ThreadTrace* devThreadTrace =
as_amd(thread_trace)->getDeviceThreadTrace();
std::unique_ptr<uint> bufSize2Se(new uint[seNum]);
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);
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);
}
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]);
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;
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -284,112 +271,122 @@ RUNTIME_EXIT
* wait for this command to complete.
* \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_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 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:
* 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 PAUSE_COMMAND is queued for thread trace object, for which BEGIN_COMMAND was not queued.
* o RESUME_COMMAND is queued for thread trace object, for which PAUSE_COMMAND was not 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.
* - 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.
* o PAUSE_COMMAND is queued for thread trace object, for which BEGIN_COMMAND was not
* queued.
* o RESUME_COMMAND is queued for thread trace object, for which PAUSE_COMMAND was not
* 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.
* - 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 ,(
cl_command_queue command_queue ,
cl_threadtrace_amd thread_trace ,
cl_threadtrace_command_name_amd command_name ,
cl_uint num_events_in_wait_list ,
const cl_event* event_wait_list ,
cl_event* event ))
{
// Check if command queue is valid
if (!is_valid(command_queue)) {
return CL_INVALID_COMMAND_QUEUE;
}
RUNTIME_ENTRY(cl_int, clEnqueueThreadTraceCommandAMD,
(cl_command_queue command_queue, cl_threadtrace_amd thread_trace,
cl_threadtrace_command_name_amd command_name, cl_uint num_events_in_wait_list,
const cl_event* event_wait_list, 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
if (!is_valid(thread_trace)) {
// Check if thread trace is valid
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;
}
}
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);
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
if (NULL == hostQueue) {
return CL_INVALID_COMMAND_QUEUE;
}
if (command == NULL) {
return CL_OUT_OF_HOST_MEMORY;
}
// Check that device associated with the command queue is the same as with thread trace
if (&hostQueue->device() != &amdThreadTrace->device()) {
return CL_INVALID_DEVICE;
}
// Submit the command to the device
command->enqueue();
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;
}
*not_null(event) = as_cl(&command->event());
if (event == NULL) {
command->release();
}
// 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;
}
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;
return CL_SUCCESS;
}
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.
// *
@@ -421,95 +418,97 @@ RUNTIME_EXIT
// * wait for this command to complete.
// * \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_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 buffer_size is negative or zero.
// * - 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_MEM_OBJECT if one on memory objects in the mem_objects array is not a valid memory object or memory_objects is NULL.
// * - 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_INVALID_OPERATION if the mem_objects_num is not equal to the number of Shader Engines of
// the [GPU] device.
// * - 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.
// * - 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
// * OpenCL implementation on the host.
// */
RUNTIME_ENTRY(cl_int,clEnqueueBindThreadTraceBufferAMD ,(cl_command_queue command_queue ,
cl_threadtrace_amd thread_trace ,
cl_mem* mem_objects ,
cl_uint mem_objects_num ,
cl_uint buffer_size ,
cl_uint num_events_in_wait_list ,
const cl_event* event_wait_list ,
cl_event* event ))
{
// Check if command queue is valid
if (!is_valid(command_queue)) {
return CL_INVALID_COMMAND_QUEUE;
}
RUNTIME_ENTRY(cl_int, clEnqueueBindThreadTraceBufferAMD,
(cl_command_queue command_queue, cl_threadtrace_amd thread_trace, cl_mem* mem_objects,
cl_uint mem_objects_num, cl_uint buffer_size, cl_uint num_events_in_wait_list,
const cl_event* event_wait_list, 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
if (!is_valid(thread_trace)) {
return CL_INVALID_OPERATION;
}
// Check if thread trace is valid
if (!is_valid(thread_trace)) {
return CL_INVALID_OPERATION;
}
// Check if input values are valid
if ((mem_objects == NULL)
|| (buffer_size <= 0)) {
return CL_INVALID_VALUE;
}
// Check if input values are valid
if ((mem_objects == NULL) || (buffer_size <= 0)) {
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
if (amdThreadTrace->deviceSeNumThreadTrace() != mem_objects_num) {
return CL_INVALID_OPERATION;
}
// Check if memory objects ,bound the thread trace,are valid
for (size_t i = 0; i < mem_objects_num; ++i) {
cl_mem obj = mem_objects[i];
if (!is_valid(obj)) {
return CL_INVALID_MEM_OBJECT;
}
// Check if the number of bound memory objects is the same as the number of SEs
if (amdThreadTrace->deviceSeNumThreadTrace() != mem_objects_num) {
return CL_INVALID_OPERATION;
}
// Check if memory objects ,bound the thread trace,are valid
for (size_t i = 0; i < mem_objects_num; ++i) {
cl_mem obj = mem_objects[i];
if (!is_valid(obj)) {
return CL_INVALID_MEM_OBJECT;
}
}
amd::HostQueue* hostQueue = as_amd(command_queue)->asHostQueue();
if (NULL == hostQueue) {
return CL_INVALID_COMMAND_QUEUE;
}
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;
}
// 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;
}
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;
}
amdThreadTrace->setState(amd::ThreadTrace::MemoryBound);
// Create a new ThreadTraceMemObjectsCommand command
amd::ThreadTraceMemObjectsCommand* command =
new amd::ThreadTraceMemObjectsCommand(*hostQueue, eventWaitList, mem_objects_num,mem_objects,buffer_size,*amdThreadTrace,CL_COMMAND_THREAD_TRACE_MEM);
if (command == NULL) {
return CL_OUT_OF_HOST_MEMORY;
}
amdThreadTrace->setState(amd::ThreadTrace::MemoryBound);
// Create a new ThreadTraceMemObjectsCommand command
amd::ThreadTraceMemObjectsCommand* command = new amd::ThreadTraceMemObjectsCommand(
*hostQueue, eventWaitList, mem_objects_num, mem_objects, buffer_size, *amdThreadTrace,
CL_COMMAND_THREAD_TRACE_MEM);
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;
}
// Submit the command to the device
command->enqueue();
// Make sure we have memory for the command execution
if (!command->validateMemory()) {
delete command;
return CL_OUT_OF_RESOURCES;
}
// Submit the command to the device
command->enqueue();
*not_null(event) = as_cl(&command->event());
if (event == NULL) {
command->release();
}
return CL_SUCCESS;
*not_null(event) = as_cl(&command->event());
if (event == NULL) {
command->release();
}
return CL_SUCCESS;
}
RUNTIME_EXIT
@@ -99,140 +99,136 @@ jurisdiction and venue of these courts.
extern "C" {
#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_threadtrace_info;
/* cl_command_type */
#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 */
typedef enum _cl_threadtrace_command_name_amd {
CL_THREAD_TRACE_BEGIN_COMMAND,
CL_THREAD_TRACE_END_COMMAND,
CL_THREAD_TRACE_PAUSE_COMMAND,
CL_THREAD_TRACE_RESUME_COMMAND
typedef enum _cl_threadtrace_command_name_amd {
CL_THREAD_TRACE_BEGIN_COMMAND,
CL_THREAD_TRACE_END_COMMAND,
CL_THREAD_TRACE_PAUSE_COMMAND,
CL_THREAD_TRACE_RESUME_COMMAND
} cl_threadtrace_command_name_amd;
// Thread trace parameters
enum ThreadTraceParameter
{
CL_THREAD_TRACE_PARAM_TOKEN_MASK,
CL_THREAD_TRACE_PARAM_REG_MASK,
CL_THREAD_TRACE_PARAM_COMPUTE_UNIT_TARGET,
CL_THREAD_TRACE_PARAM_SHADER_ARRAY_TARGET,
CL_THREAD_TRACE_PARAM_SIMD_MASK,
CL_THREAD_TRACE_PARAM_VM_ID_MASK,
CL_THREAD_TRACE_PARAM_RANDOM_SEED,
CL_THREAD_TRACE_PARAM_CAPTURE_MODE,
CL_THREAD_TRACE_PARAM_INSTRUCTION_MASK,
CL_THREAD_TRACE_PARAM_USER_DATA,
CL_THREAD_TRACE_PARAM_IS_WRAPPED
enum ThreadTraceParameter {
CL_THREAD_TRACE_PARAM_TOKEN_MASK,
CL_THREAD_TRACE_PARAM_REG_MASK,
CL_THREAD_TRACE_PARAM_COMPUTE_UNIT_TARGET,
CL_THREAD_TRACE_PARAM_SHADER_ARRAY_TARGET,
CL_THREAD_TRACE_PARAM_SIMD_MASK,
CL_THREAD_TRACE_PARAM_VM_ID_MASK,
CL_THREAD_TRACE_PARAM_RANDOM_SEED,
CL_THREAD_TRACE_PARAM_CAPTURE_MODE,
CL_THREAD_TRACE_PARAM_INSTRUCTION_MASK,
CL_THREAD_TRACE_PARAM_USER_DATA,
CL_THREAD_TRACE_PARAM_IS_WRAPPED
};
// CL_THREAD_TRACE_PARAM_TOKEN_MASK data selects for SI
enum CL_THREAD_TRACE_TOKEN_MASK
{
//Time passed
CL_THREAD_TRACE_TOKEN_MASK_TIME_SI = 0x00000001,
//Resync the timestamp
CL_THREAD_TRACE_TOKEN_MASK_TIMESTAMP_SI = 0x00000002,
//A register write has occurred
CL_THREAD_TRACE_TOKEN_MASK_REG_SI = 0x00000004,
//A wavefront has started
CL_THREAD_TRACE_TOKEN_MASK_WAVE_START_SI = 0x00000008,
//Output space has been allocated for color/Z [Should be used for cl-gl]
CL_THREAD_TRACE_TOKEN_MASK_WAVE_PS_ALLOC_SI = 0x00000010,
//Output space has been allocated for vertex position [Should be used for cl-gl]
CL_THREAD_TRACE_TOKEN_MASK_WAVE_VS_ALLOC_SI = 0x00000020,
//Wavefront completion
CL_THREAD_TRACE_TOKEN_MASK_WAVE_END_SI = 0x00000040,
//An event has reached the top of a shader stage. In-order with WAVE_START
CL_THREAD_TRACE_TOKEN_MASK_EVENT_SI = 0x00000080,
//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,
//An event has reached the top of a shader stage for the second GFX pipe. In-order with WAVE_START.
//[Should be used for cl-gl]
CL_THREAD_TRACE_TOKEN_MASK_EVENT_GFX_SI = 0x00000200,
//The kernel has executed an instruction
CL_THREAD_TRACE_TOKEN_MASK_INST_SI = 0x00000400,
//The kernel has explicitly written the PC value
CL_THREAD_TRACE_TOKEN_MASK_INST_PC_SI = 0x00000800,
//The kernel has written user data into the thread trace buffer
CL_THREAD_TRACE_TOKEN_MASK_INST_USERDATA_SI = 0x00001000,
//Provides information about instruction scheduling
CL_THREAD_TRACE_TOKEN_MASK_ISSUE_SI = 0x00002000,
//The performance counter delta has been updated
CL_THREAD_TRACE_TOKEN_MASK_PERF_SI = 0x00004000,
//A miscellaneous event has been sent
CL_THREAD_TRACE_TOKEN_MASK_MISC_SI = 0x00008000,
//All possible tokens
CL_THREAD_TRACE_TOKEN_MASK_ALL_SI = 0x0000ffff,
enum CL_THREAD_TRACE_TOKEN_MASK {
// Time passed
CL_THREAD_TRACE_TOKEN_MASK_TIME_SI = 0x00000001,
// Resync the timestamp
CL_THREAD_TRACE_TOKEN_MASK_TIMESTAMP_SI = 0x00000002,
// A register write has occurred
CL_THREAD_TRACE_TOKEN_MASK_REG_SI = 0x00000004,
// A wavefront has started
CL_THREAD_TRACE_TOKEN_MASK_WAVE_START_SI = 0x00000008,
// Output space has been allocated for color/Z [Should be used for cl-gl]
CL_THREAD_TRACE_TOKEN_MASK_WAVE_PS_ALLOC_SI = 0x00000010,
// Output space has been allocated for vertex position [Should be used for cl-gl]
CL_THREAD_TRACE_TOKEN_MASK_WAVE_VS_ALLOC_SI = 0x00000020,
// Wavefront completion
CL_THREAD_TRACE_TOKEN_MASK_WAVE_END_SI = 0x00000040,
// An event has reached the top of a shader stage. In-order with WAVE_START
CL_THREAD_TRACE_TOKEN_MASK_EVENT_SI = 0x00000080,
// 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,
// An event has reached the top of a shader stage for the second GFX pipe. In-order with
// WAVE_START.
//[Should be used for cl-gl]
CL_THREAD_TRACE_TOKEN_MASK_EVENT_GFX_SI = 0x00000200,
// The kernel has executed an instruction
CL_THREAD_TRACE_TOKEN_MASK_INST_SI = 0x00000400,
// The kernel has explicitly written the PC value
CL_THREAD_TRACE_TOKEN_MASK_INST_PC_SI = 0x00000800,
// The kernel has written user data into the thread trace buffer
CL_THREAD_TRACE_TOKEN_MASK_INST_USERDATA_SI = 0x00001000,
// Provides information about instruction scheduling
CL_THREAD_TRACE_TOKEN_MASK_ISSUE_SI = 0x00002000,
// The performance counter delta has been updated
CL_THREAD_TRACE_TOKEN_MASK_PERF_SI = 0x00004000,
// A miscellaneous event has been sent
CL_THREAD_TRACE_TOKEN_MASK_MISC_SI = 0x00008000,
// All possible tokens
CL_THREAD_TRACE_TOKEN_MASK_ALL_SI = 0x0000ffff,
};
//CL_THREAD_TRACE_PARAM_REG_MASK data selects
enum CL_THREAD_TRACE_REG_MASK
{
//Event initiator
CL_THREAD_TRACE_REG_MASK_EVENT_SI = 0x00000001,
//Draw initiator [Should be used for cl-gl]
CL_THREAD_TRACE_REG_MASK_DRAW_SI = 0x00000002,
//Dispatch initiator
CL_THREAD_TRACE_REG_MASK_DISPATCH_SI = 0x00000004,
//User data from host
CL_THREAD_TRACE_REG_MASK_USERDATA_SI = 0x00000008,
//GFXDEC register (8-state) [Should be used for cl-gl]
CL_THREAD_TRACE_REG_MASK_GFXDEC_SI = 0x00000020,
//SHDEC register (many state)
CL_THREAD_TRACE_REG_MASK_SHDEC_SI = 0x00000040,
//Other registers
CL_THREAD_TRACE_REG_MASK_OTHER_SI = 0x00000080,
//All possible registers types
CL_THREAD_TRACE_REG_MASK_ALL_SI = 0x000000ff,
// CL_THREAD_TRACE_PARAM_REG_MASK data selects
enum CL_THREAD_TRACE_REG_MASK {
// Event initiator
CL_THREAD_TRACE_REG_MASK_EVENT_SI = 0x00000001,
// Draw initiator [Should be used for cl-gl]
CL_THREAD_TRACE_REG_MASK_DRAW_SI = 0x00000002,
// Dispatch initiator
CL_THREAD_TRACE_REG_MASK_DISPATCH_SI = 0x00000004,
// User data from host
CL_THREAD_TRACE_REG_MASK_USERDATA_SI = 0x00000008,
// GFXDEC register (8-state) [Should be used for cl-gl]
CL_THREAD_TRACE_REG_MASK_GFXDEC_SI = 0x00000020,
// SHDEC register (many state)
CL_THREAD_TRACE_REG_MASK_SHDEC_SI = 0x00000040,
// Other registers
CL_THREAD_TRACE_REG_MASK_OTHER_SI = 0x00000080,
// All possible registers types
CL_THREAD_TRACE_REG_MASK_ALL_SI = 0x000000ff,
};
//CL_THREAD_TRACE_PARAM_VM_ID_MASK data selects
enum CL_THREAD_TRACE_VM_ID_MASK
{
//Capture only data from the VM_ID used to write {SQTT}_BASE
CL_THREAD_TRACE_VM_ID_MASK_SINGLE = 0,
//Capture all data from all VM_IDs
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
CL_THREAD_TRACE_VM_ID_MASK_SINGLE_DETAIL = 2
// CL_THREAD_TRACE_PARAM_VM_ID_MASK data selects
enum CL_THREAD_TRACE_VM_ID_MASK {
// Capture only data from the VM_ID used to write {SQTT}_BASE
CL_THREAD_TRACE_VM_ID_MASK_SINGLE = 0,
// Capture all data from all VM_IDs
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
CL_THREAD_TRACE_VM_ID_MASK_SINGLE_DETAIL = 2
};
//CL_THREAD_TRACE_PARAM_CAPTURE_MODE data
enum CL_THREAD_TRACE_CAPTURE_MODE
{
//Capture all data in the thread trace buffer
CL_THREAD_TRACE_CAPTURE_ALL = 0,
//Capture only data between THREAD_TRACE_START and THREAD_TRACE_STOP events
CL_THREAD_TRACE_CAPTURE_SELECT = 1,
//Capture data between THREAD_TRACE_START and THREAD_TRACE_/STOP events,
//and global/reference data at all times
CL_THREAD_TRACE_CAPTURE_SELECT_DETAIL = 2
// CL_THREAD_TRACE_PARAM_CAPTURE_MODE data
enum CL_THREAD_TRACE_CAPTURE_MODE {
// Capture all data in the thread trace buffer
CL_THREAD_TRACE_CAPTURE_ALL = 0,
// Capture only data between THREAD_TRACE_START and THREAD_TRACE_STOP events
CL_THREAD_TRACE_CAPTURE_SELECT = 1,
// Capture data between THREAD_TRACE_START and THREAD_TRACE_/STOP events,
// and global/reference data at all times
CL_THREAD_TRACE_CAPTURE_SELECT_DETAIL = 2
};
//CL_THREAD_TRACE_PARAM_INSTRUCTION_MASK data selects
enum CL_THREAD_TRACE_INSTRUCTION_MASK
{
//Generate {SQTT}_TOKEN_INST tokens for all instructions
CL_THREAD_TRACE_INST_MASK_ALL,
//Generate {SQTT}_TOKEN_INST tokens for stalled instructions only
CL_THREAD_TRACE_INST_MASK_STALLED,
//Generate {SQTT}_TOKEN_INST messages for stalled and other (no op/wait/set prio/etc) instructions
CL_THREAD_TRACE_INST_MASK_STALLED_AND_IMMEDIATE,
//Generate {SQTT}_TOKEN_INST messages for immediate instructions only only [ Should be used only for CI]
CL_THREAD_TRACE_INST_MASK_IMMEDIATE_CI,
// CL_THREAD_TRACE_PARAM_INSTRUCTION_MASK data selects
enum CL_THREAD_TRACE_INSTRUCTION_MASK {
// Generate {SQTT}_TOKEN_INST tokens for all instructions
CL_THREAD_TRACE_INST_MASK_ALL,
// Generate {SQTT}_TOKEN_INST tokens for stalled instructions only
CL_THREAD_TRACE_INST_MASK_STALLED,
// Generate {SQTT}_TOKEN_INST messages for stalled and other (no op/wait/set prio/etc)
// instructions
CL_THREAD_TRACE_INST_MASK_STALLED_AND_IMMEDIATE,
// Generate {SQTT}_TOKEN_INST messages for immediate instructions only only [ Should be used only
// for CI]
CL_THREAD_TRACE_INST_MASK_IMMEDIATE_CI,
};
enum ThreadTraceInfo
{
CL_THREAD_TRACE_SE,
CL_THREAD_TRACE_BUFFERS_FILLED,
CL_THREAD_TRACE_BUFFERS_SIZE
enum ThreadTraceInfo {
CL_THREAD_TRACE_SE,
CL_THREAD_TRACE_BUFFERS_FILLED,
CL_THREAD_TRACE_BUFFERS_SIZE
};
@@ -251,27 +247,24 @@ enum ThreadTraceInfo
*
* \return the created threadTrace object
*/
extern CL_API_ENTRY cl_threadtrace_amd CL_API_CALL
clCreateThreadTraceAMD(
cl_device_id /* device */,
cl_int* /* errcode_ret */
) CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_threadtrace_amd CL_API_CALL clCreateThreadTraceAMD(
cl_device_id /* device */, cl_int* /* errcode_ret */
) CL_API_SUFFIX__VERSION_1_0;
/*! \brief Destroys a cl_threadtrace_amd object.
*
* \param threadTrace the cl_threadtrace_amd object for release
*
* \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
* 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
clReleaseThreadTraceAMD(
cl_threadtrace_amd /* threadTrace */
) CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_int CL_API_CALL clReleaseThreadTraceAMD(cl_threadtrace_amd /* threadTrace */
) CL_API_SUFFIX__VERSION_1_0;
/*! \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
OpenCL implementation on the host.
*/
extern CL_API_ENTRY cl_int CL_API_CALL
clRetainThreadTraceAMD(
cl_threadtrace_amd /* threadTrace */
) CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_int CL_API_CALL clRetainThreadTraceAMD(cl_threadtrace_amd /* threadTrace */
) CL_API_SUFFIX__VERSION_1_0;
/*! \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
*
* \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 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.
* - 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
OpenCL implementation on the host.
*/
extern CL_API_ENTRY cl_int CL_API_CALL
clSetThreadTraceParamAMD(cl_threadtrace_amd /*thread_trace*/ ,
cl_thread_trace_param /*config_param*/ ,
cl_uint /*param_value*/
)CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_int CL_API_CALL clSetThreadTraceParamAMD(
cl_threadtrace_amd /*thread_trace*/, cl_thread_trace_param /*config_param*/,
cl_uint /*param_value*/
) 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.
*
@@ -345,28 +338,30 @@ clSetThreadTraceParamAMD(cl_threadtrace_amd /*thread_trace*/ ,
* wait for this command to complete.
* \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_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 buffer_size is negative or zero.
* - 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_MEM_OBJECT if one on memory objects in the mem_objects array is not a valid memory object or memory_objects is NULL.
* - 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_INVALID_OPERATION if the mem_objects_num is not equal to the number of Shader Engines of
* the [GPU] device.
* - 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.
* - 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
* OpenCL implementation on the host.
*/
extern CL_API_ENTRY cl_int CL_API_CALL
clEnqueueBindThreadTraceBufferAMD(cl_command_queue command_queue ,
cl_threadtrace_amd /*thread_trace*/ ,
cl_mem* /*mem_objects*/ ,
cl_uint /*mem_objects_num*/ ,
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;
extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueBindThreadTraceBufferAMD(
cl_command_queue command_queue, cl_threadtrace_amd /*thread_trace*/, cl_mem* /*mem_objects*/,
cl_uint /*mem_objects_num*/, 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.
*
@@ -392,14 +387,10 @@ clEnqueueBindThreadTraceBufferAMD(cl_command_queue command_queue ,
* OpenCL implementation on the host.
* CL_SUCCESS if the function is executed successfully.
*/
extern CL_API_ENTRY cl_int CL_API_CALL
clGetThreadTraceInfoAMD(
cl_threadtrace_amd /* thread_trace */,
cl_threadtrace_info /*thread_trace_info_param*/,
size_t /*param_value_size*/,
void* /*param_value*/,
size_t* /*param_value_size_ret*/
) CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_int CL_API_CALL clGetThreadTraceInfoAMD(
cl_threadtrace_amd /* thread_trace */, cl_threadtrace_info /*thread_trace_info_param*/,
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.
*
@@ -409,31 +400,36 @@ clGetThreadTraceInfoAMD(
*
* \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_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 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:
* 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 PAUSE_COMMAND is queued for thread trace object, for which BEGIN_COMMAND was not queued.
* o RESUME_COMMAND is queued for thread trace object, for which PAUSE_COMMAND was not 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.
* - 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.
* o PAUSE_COMMAND is queued for thread trace object, for which BEGIN_COMMAND was not
* queued.
* o RESUME_COMMAND is queued for thread trace object, for which PAUSE_COMMAND was not
* 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.
* - 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
clEnqueueThreadTraceCommandAMD(
cl_command_queue /*command_queue*/ ,
cl_threadtrace_amd /*thread_trace*/ ,
cl_threadtrace_command_name_amd /*command_name*/ ,
cl_uint /*num_events_in_wait_list*/ ,
const cl_event* /*event_wait_list*/,
cl_event* /*event*/
)CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueThreadTraceCommandAMD(
cl_command_queue /*command_queue*/, cl_threadtrace_amd /*thread_trace*/,
cl_threadtrace_command_name_amd /*command_name*/, cl_uint /*num_events_in_wait_list*/,
const cl_event* /*event_wait_list*/, cl_event* /*event*/
) CL_API_SUFFIX__VERSION_1_0;
#ifdef __cplusplus
} /*extern "C"*/
#endif /*__cplusplus*/
#endif /*__CL_THREAD_TRACE_AMD_H*/
#endif /*__CL_THREAD_TRACE_AMD_H*/