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:
1 parent
a615e4fbb6
commit
465c1c0287
188 files changed
+68131
-78046
No files matched your search
+111
-149
@@ -13,43 +13,33 @@
|
||||
|
||||
//! \addtogroup Utils
|
||||
|
||||
namespace amd {/*@{*/
|
||||
namespace amd { /*@{*/
|
||||
|
||||
namespace details {
|
||||
|
||||
template <typename T, int N>
|
||||
struct TaggedPointerHelper
|
||||
{
|
||||
static const uintptr_t TagMask = (1u << N) - 1;
|
||||
template <typename T, int N> struct TaggedPointerHelper {
|
||||
static const uintptr_t TagMask = (1u << N) - 1;
|
||||
|
||||
private:
|
||||
TaggedPointerHelper(); // Cannot instantiate
|
||||
void* operator new(size_t); // allocate or
|
||||
void operator delete(void*); // delete a TaggedPointerHelper.
|
||||
private:
|
||||
TaggedPointerHelper(); // Cannot instantiate
|
||||
void* operator new(size_t); // allocate or
|
||||
void operator delete(void*); // delete a TaggedPointerHelper.
|
||||
|
||||
public:
|
||||
//! Create a tagged pointer.
|
||||
static TaggedPointerHelper* make(T* ptr, size_t tag)
|
||||
{
|
||||
return reinterpret_cast<TaggedPointerHelper*>(
|
||||
(reinterpret_cast<uintptr_t>(ptr) & ~TagMask) | (tag & TagMask));
|
||||
}
|
||||
public:
|
||||
//! Create a tagged pointer.
|
||||
static TaggedPointerHelper* make(T* ptr, size_t tag) {
|
||||
return reinterpret_cast<TaggedPointerHelper*>((reinterpret_cast<uintptr_t>(ptr) & ~TagMask) |
|
||||
(tag & TagMask));
|
||||
}
|
||||
|
||||
//! Return the pointer value.
|
||||
T* ptr()
|
||||
{
|
||||
return reinterpret_cast<T*>(
|
||||
reinterpret_cast<uintptr_t>(this) & ~TagMask);
|
||||
}
|
||||
//! Return the pointer value.
|
||||
T* ptr() { return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(this) & ~TagMask); }
|
||||
|
||||
//! Return the tag value.
|
||||
size_t tag() const
|
||||
{
|
||||
return reinterpret_cast<uintptr_t>(this) & TagMask;
|
||||
}
|
||||
//! Return the tag value.
|
||||
size_t tag() const { return reinterpret_cast<uintptr_t>(this) & TagMask; }
|
||||
};
|
||||
|
||||
} // namespace details
|
||||
} // namespace details
|
||||
|
||||
/*! \brief An unbounded thread-safe queue.
|
||||
*
|
||||
@@ -60,153 +50,125 @@ public:
|
||||
* FIXME_lmoriche: Implement the new/delete operators for SimplyLinkedNode
|
||||
* using thread-local allocation buffers.
|
||||
*/
|
||||
template <typename T, int N = 5>
|
||||
class ConcurrentLinkedQueue : public HeapObject
|
||||
{
|
||||
//! A simply-linked node
|
||||
struct Node
|
||||
{
|
||||
typedef details::TaggedPointerHelper<Node,N> TaggedPointerHelper;
|
||||
typedef TaggedPointerHelper* Ptr;
|
||||
template <typename T, int N = 5> class ConcurrentLinkedQueue : public HeapObject {
|
||||
//! A simply-linked node
|
||||
struct Node {
|
||||
typedef details::TaggedPointerHelper<Node, N> TaggedPointerHelper;
|
||||
typedef TaggedPointerHelper* Ptr;
|
||||
|
||||
T value_; //!< The value stored in that node.
|
||||
std::atomic<Ptr> next_; //!< Pointer to the next node
|
||||
T value_; //!< The value stored in that node.
|
||||
std::atomic<Ptr> next_; //!< Pointer to the next node
|
||||
|
||||
//! Create a Node::Ptr
|
||||
static inline Ptr ptr(Node* ptr, size_t counter = 0)
|
||||
{
|
||||
return TaggedPointerHelper::make(ptr, counter);
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
std::atomic<typename Node::Ptr> head_; //! Pointer to the oldest element.
|
||||
std::atomic<typename Node::Ptr> tail_; //! Pointer to the most recent element.
|
||||
|
||||
private:
|
||||
//! \brief Allocate a free node.
|
||||
static inline Node* allocNode()
|
||||
{
|
||||
return new(AlignedMemory::allocate(sizeof(Node), 1 << N)) Node();
|
||||
//! Create a Node::Ptr
|
||||
static inline Ptr ptr(Node* ptr, size_t counter = 0) {
|
||||
return TaggedPointerHelper::make(ptr, counter);
|
||||
}
|
||||
};
|
||||
|
||||
//! \brief Return a node to the free list.
|
||||
static inline void reclaimNode(Node* node)
|
||||
{
|
||||
AlignedMemory::deallocate(node);
|
||||
}
|
||||
private:
|
||||
std::atomic<typename Node::Ptr> head_; //! Pointer to the oldest element.
|
||||
std::atomic<typename Node::Ptr> tail_; //! Pointer to the most recent element.
|
||||
|
||||
public:
|
||||
//! \brief Initialize a new concurrent linked queue.
|
||||
ConcurrentLinkedQueue();
|
||||
private:
|
||||
//! \brief Allocate a free node.
|
||||
static inline Node* allocNode() {
|
||||
return new (AlignedMemory::allocate(sizeof(Node), 1 << N)) Node();
|
||||
}
|
||||
|
||||
//! \brief Destroy this concurrent linked queue.
|
||||
~ConcurrentLinkedQueue();
|
||||
//! \brief Return a node to the free list.
|
||||
static inline void reclaimNode(Node* node) { AlignedMemory::deallocate(node); }
|
||||
|
||||
//! \brief Enqueue an element to this queue.
|
||||
inline void enqueue(T elem);
|
||||
public:
|
||||
//! \brief Initialize a new concurrent linked queue.
|
||||
ConcurrentLinkedQueue();
|
||||
|
||||
//! \brief Dequeue an element from this queue.
|
||||
inline T dequeue();
|
||||
//! \brief Destroy this concurrent linked queue.
|
||||
~ConcurrentLinkedQueue();
|
||||
|
||||
//! \brief Enqueue an element to this queue.
|
||||
inline void enqueue(T elem);
|
||||
|
||||
//! \brief Dequeue an element from this queue.
|
||||
inline T dequeue();
|
||||
};
|
||||
|
||||
/*@}*/
|
||||
|
||||
template <typename T, int N>
|
||||
inline
|
||||
ConcurrentLinkedQueue<T,N>::ConcurrentLinkedQueue()
|
||||
{
|
||||
// Create the first "dummy" node.
|
||||
Node* dummy = allocNode();
|
||||
dummy->next_ = NULL;
|
||||
DEBUG_ONLY(dummy->value_ = NULL);
|
||||
template <typename T, int N> inline ConcurrentLinkedQueue<T, N>::ConcurrentLinkedQueue() {
|
||||
// Create the first "dummy" node.
|
||||
Node* dummy = allocNode();
|
||||
dummy->next_ = NULL;
|
||||
DEBUG_ONLY(dummy->value_ = NULL);
|
||||
|
||||
// Head and tail should now point to it (empty list).
|
||||
head_ = tail_ = Node::ptr(dummy);
|
||||
// Head and tail should now point to it (empty list).
|
||||
head_ = tail_ = Node::ptr(dummy);
|
||||
|
||||
// Make sure the instance is fully initialized before it becomes
|
||||
// globally visible.
|
||||
std::atomic_thread_fence(std::memory_order_release);
|
||||
// Make sure the instance is fully initialized before it becomes
|
||||
// globally visible.
|
||||
std::atomic_thread_fence(std::memory_order_release);
|
||||
}
|
||||
|
||||
template <typename T, int N>
|
||||
inline
|
||||
ConcurrentLinkedQueue<T,N>::~ConcurrentLinkedQueue()
|
||||
{
|
||||
typename Node::Ptr head = head_;
|
||||
typename Node::Ptr tail = tail_;
|
||||
while (head->ptr() != tail->ptr()) {
|
||||
Node* node = head->ptr();
|
||||
head = head->ptr()->next_;
|
||||
reclaimNode(node);
|
||||
}
|
||||
reclaimNode(head->ptr());
|
||||
template <typename T, int N> inline ConcurrentLinkedQueue<T, N>::~ConcurrentLinkedQueue() {
|
||||
typename Node::Ptr head = head_;
|
||||
typename Node::Ptr tail = tail_;
|
||||
while (head->ptr() != tail->ptr()) {
|
||||
Node* node = head->ptr();
|
||||
head = head->ptr()->next_;
|
||||
reclaimNode(node);
|
||||
}
|
||||
reclaimNode(head->ptr());
|
||||
}
|
||||
|
||||
template <typename T, int N>
|
||||
inline void
|
||||
ConcurrentLinkedQueue<T,N>::enqueue(T elem)
|
||||
{
|
||||
Node* node = allocNode();
|
||||
node->value_ = elem;
|
||||
node->next_ = NULL;
|
||||
template <typename T, int N> inline void ConcurrentLinkedQueue<T, N>::enqueue(T elem) {
|
||||
Node* node = allocNode();
|
||||
node->value_ = elem;
|
||||
node->next_ = NULL;
|
||||
|
||||
for (;;) {
|
||||
typename Node::Ptr tail = tail_.load(std::memory_order_acquire);
|
||||
typename Node::Ptr next =
|
||||
tail->ptr()->next_.load(std::memory_order_acquire);
|
||||
if (likely(tail == tail_.load(std::memory_order_acquire))) {
|
||||
if (next->ptr() == NULL) {
|
||||
if (tail->ptr()->next_.compare_exchange_weak(
|
||||
next, Node::ptr(node, next->tag()+1),
|
||||
std::memory_order_acq_rel, std::memory_order_acquire)) {
|
||||
tail_.compare_exchange_strong(
|
||||
tail, Node::ptr(node, tail->tag()+1),
|
||||
std::memory_order_acq_rel, std::memory_order_acquire);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
tail_.compare_exchange_strong(
|
||||
tail, Node::ptr(next->ptr(), tail->tag()+1),
|
||||
std::memory_order_acq_rel, std::memory_order_acquire);
|
||||
}
|
||||
for (;;) {
|
||||
typename Node::Ptr tail = tail_.load(std::memory_order_acquire);
|
||||
typename Node::Ptr next = tail->ptr()->next_.load(std::memory_order_acquire);
|
||||
if (likely(tail == tail_.load(std::memory_order_acquire))) {
|
||||
if (next->ptr() == NULL) {
|
||||
if (tail->ptr()->next_.compare_exchange_weak(next, Node::ptr(node, next->tag() + 1),
|
||||
std::memory_order_acq_rel,
|
||||
std::memory_order_acquire)) {
|
||||
tail_.compare_exchange_strong(tail, Node::ptr(node, tail->tag() + 1),
|
||||
std::memory_order_acq_rel, std::memory_order_acquire);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
tail_.compare_exchange_strong(tail, Node::ptr(next->ptr(), tail->tag() + 1),
|
||||
std::memory_order_acq_rel, std::memory_order_acquire);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T, int N>
|
||||
inline T
|
||||
ConcurrentLinkedQueue<T,N>::dequeue()
|
||||
{
|
||||
for (;;) {
|
||||
typename Node::Ptr head = head_.load(std::memory_order_acquire);
|
||||
typename Node::Ptr tail = tail_.load(std::memory_order_acquire);
|
||||
typename Node::Ptr next =
|
||||
head->ptr()->next_.load(std::memory_order_acquire);
|
||||
if (likely(head == head_.load(std::memory_order_acquire))) {
|
||||
if (head->ptr() == tail->ptr()) {
|
||||
if (next->ptr() == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
tail_.compare_exchange_strong(
|
||||
tail, Node::ptr(next->ptr(), tail->tag()+1),
|
||||
std::memory_order_acq_rel, std::memory_order_acquire);
|
||||
}
|
||||
else {
|
||||
T value = next->ptr()->value_;
|
||||
if (head_.compare_exchange_weak(
|
||||
head, Node::ptr(next->ptr(), head->tag()+1),
|
||||
std::memory_order_acq_rel, std::memory_order_acquire)) {
|
||||
// we can reclaim head now
|
||||
reclaimNode(head->ptr());
|
||||
return value;
|
||||
}
|
||||
}
|
||||
template <typename T, int N> inline T ConcurrentLinkedQueue<T, N>::dequeue() {
|
||||
for (;;) {
|
||||
typename Node::Ptr head = head_.load(std::memory_order_acquire);
|
||||
typename Node::Ptr tail = tail_.load(std::memory_order_acquire);
|
||||
typename Node::Ptr next = head->ptr()->next_.load(std::memory_order_acquire);
|
||||
if (likely(head == head_.load(std::memory_order_acquire))) {
|
||||
if (head->ptr() == tail->ptr()) {
|
||||
if (next->ptr() == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
tail_.compare_exchange_strong(tail, Node::ptr(next->ptr(), tail->tag() + 1),
|
||||
std::memory_order_acq_rel, std::memory_order_acquire);
|
||||
} else {
|
||||
T value = next->ptr()->value_;
|
||||
if (head_.compare_exchange_weak(head, Node::ptr(next->ptr(), head->tag() + 1),
|
||||
std::memory_order_acq_rel, std::memory_order_acquire)) {
|
||||
// we can reclaim head now
|
||||
reclaimNode(head->ptr());
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace amd
|
||||
} // namespace amd
|
||||
|
||||
#endif /*CONCURRENT_HPP_*/
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "os/os.hpp"
|
||||
|
||||
#if !defined(LOG_LEVEL)
|
||||
# include "utils/flags.hpp"
|
||||
#include "utils/flags.hpp"
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
@@ -16,77 +16,63 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif // _WIN32
|
||||
#endif // _WIN32
|
||||
|
||||
namespace amd {
|
||||
|
||||
//! \cond ignore
|
||||
extern "C" void
|
||||
breakpoint(void)
|
||||
{
|
||||
extern "C" void breakpoint(void) {
|
||||
#ifdef _MSC_VER
|
||||
DebugBreak();
|
||||
#endif // _MSC_VER
|
||||
DebugBreak();
|
||||
#endif // _MSC_VER
|
||||
}
|
||||
//! \endcond
|
||||
|
||||
void
|
||||
report_fatal(const char* file, int line, const char* message)
|
||||
{
|
||||
// FIXME_lmoriche: Obfuscate the message string
|
||||
fprintf(stderr, "%s:%d: %s\n", file, line, message);
|
||||
::abort();
|
||||
void report_fatal(const char* file, int line, const char* message) {
|
||||
// FIXME_lmoriche: Obfuscate the message string
|
||||
fprintf(stderr, "%s:%d: %s\n", file, line, message);
|
||||
::abort();
|
||||
}
|
||||
|
||||
void
|
||||
report_warning(const char* message)
|
||||
{
|
||||
fprintf(stderr, "Warning: %s\n", message);
|
||||
void report_warning(const char* message) { fprintf(stderr, "Warning: %s\n", message); }
|
||||
|
||||
void log_entry(LogLevel level, const char* file, int line, const char* message) {
|
||||
if (level == LOG_NONE) {
|
||||
return;
|
||||
}
|
||||
fprintf(stderr, ":%d:%s:%d: %s\n", level, file, line, message);
|
||||
}
|
||||
|
||||
void
|
||||
log_entry(LogLevel level, const char* file, int line, const char* message)
|
||||
{
|
||||
if (level == LOG_NONE) {
|
||||
return;
|
||||
}
|
||||
fprintf(stderr, ":%d:%s:%d: %s\n", level, file, line, message);
|
||||
}
|
||||
void log_timestamped(LogLevel level, const char* file, int line, const char* message) {
|
||||
static bool gotstart = false; // not thread-safe, but not scary if fails
|
||||
static uint64_t start;
|
||||
|
||||
void
|
||||
log_timestamped(LogLevel level, const char* file, int line, const char* message)
|
||||
{
|
||||
static bool gotstart = false; // not thread-safe, but not scary if fails
|
||||
static uint64_t start;
|
||||
if (!gotstart) {
|
||||
start = Os::timeNanos();
|
||||
gotstart = true;
|
||||
}
|
||||
|
||||
if (!gotstart) {
|
||||
start = Os::timeNanos();
|
||||
gotstart = true;
|
||||
}
|
||||
|
||||
uint64_t time = Os::timeNanos() - start;
|
||||
if (level == LOG_NONE) {
|
||||
return;
|
||||
}
|
||||
uint64_t time = Os::timeNanos() - start;
|
||||
if (level == LOG_NONE) {
|
||||
return;
|
||||
}
|
||||
#if 0
|
||||
fprintf(stderr, ":%d:%s:%d: (%010lld) %s\n", level, file, line, time, message);
|
||||
#else // if you prefer fixed-width fields
|
||||
fprintf(stderr, ":% 2d:%15s:% 5d: (%010lld) %s\n",
|
||||
level, file, line, time/100ULL, message); // timestamp is 100ns units
|
||||
#else // if you prefer fixed-width fields
|
||||
fprintf(stderr, ":% 2d:%15s:% 5d: (%010lld) %s\n", level, file, line, time / 100ULL,
|
||||
message); // timestamp is 100ns units
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
log_printf(LogLevel level, const char* file, int line, const char* format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
void log_printf(LogLevel level, const char* file, int line, const char* format, ...) {
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
char message[1024];
|
||||
vsprintf(message, format, ap);
|
||||
va_end(ap);
|
||||
va_start(ap, format);
|
||||
char message[1024];
|
||||
vsprintf(message, format, ap);
|
||||
va_end(ap);
|
||||
|
||||
fprintf(stderr, ":%d:%s:%d: %s\n", level, file, line, message);
|
||||
fprintf(stderr, ":%d:%s:%d: %s\n", level, file, line, message);
|
||||
}
|
||||
|
||||
} // namespace amd
|
||||
} // namespace amd
|
||||
@@ -10,45 +10,28 @@
|
||||
|
||||
//! \addtogroup Utils
|
||||
|
||||
namespace amd {/*@{*/
|
||||
namespace amd { /*@{*/
|
||||
|
||||
enum LogLevel {
|
||||
LOG_NONE = 0,
|
||||
LOG_ERROR = 1,
|
||||
LOG_WARNING = 2,
|
||||
LOG_INFO = 3,
|
||||
LOG_DEBUG = 4
|
||||
};
|
||||
enum LogLevel { LOG_NONE = 0, LOG_ERROR = 1, LOG_WARNING = 2, LOG_INFO = 3, LOG_DEBUG = 4 };
|
||||
|
||||
//! \cond ignore
|
||||
extern "C" void
|
||||
breakpoint();
|
||||
extern "C" void breakpoint();
|
||||
//! \endcond
|
||||
|
||||
//! \brief Report a Fatal exception message and abort.
|
||||
extern void
|
||||
report_fatal(const char* file, int line, const char* message);
|
||||
extern void report_fatal(const char* file, int line, const char* message);
|
||||
|
||||
//! \brief Display a warning message.
|
||||
extern void
|
||||
report_warning(const char* message);
|
||||
extern void report_warning(const char* message);
|
||||
|
||||
//! \brief Insert a log entry.
|
||||
extern void
|
||||
log_entry(LogLevel level, const char* file, int line, const char* messsage);
|
||||
extern void log_entry(LogLevel level, const char* file, int line, const char* messsage);
|
||||
|
||||
//! \brief Insert a timestamped log entry.
|
||||
extern void
|
||||
log_timestamped(LogLevel level, const char* file, int line, const char* messsage);
|
||||
extern void log_timestamped(LogLevel level, const char* file, int line, const char* messsage);
|
||||
|
||||
//! \brief Insert a printf-style log entry.
|
||||
extern void
|
||||
log_printf(
|
||||
LogLevel level,
|
||||
const char* file,
|
||||
int line,
|
||||
const char* format,
|
||||
...);
|
||||
extern void log_printf(LogLevel level, const char* file, int line, const char* format, ...);
|
||||
|
||||
/*@}*/} // namespace amd
|
||||
|
||||
@@ -57,31 +40,28 @@ log_printf(
|
||||
// Disable ICC's warning #279: controlling expression is constant
|
||||
// (0!=1 && "msg")
|
||||
// ^
|
||||
#pragma warning ( disable : 279 )
|
||||
#pragma warning(disable : 279)
|
||||
|
||||
#endif // __INTEL_COMPILER
|
||||
#endif // __INTEL_COMPILER
|
||||
|
||||
//! \brief Abort the program if the invariant \a cond is false.
|
||||
#define guarantee(cond) \
|
||||
if (!(cond)) \
|
||||
{ \
|
||||
amd::report_fatal(__FILE__, __LINE__, \
|
||||
"guarantee(" XSTR(cond) ")"); \
|
||||
amd::breakpoint(); \
|
||||
}
|
||||
#define guarantee(cond) \
|
||||
if (!(cond)) { \
|
||||
amd::report_fatal(__FILE__, __LINE__, "guarantee(" XSTR(cond) ")"); \
|
||||
amd::breakpoint(); \
|
||||
}
|
||||
|
||||
#define fixme_guarantee(cond) guarantee(cond)
|
||||
|
||||
//! \brief Abort the program with a fatal error message.
|
||||
#define fatal(msg) do { assert(false && msg); } while (0)
|
||||
#define fatal(msg) \
|
||||
do { \
|
||||
assert(false && msg); \
|
||||
} while (0)
|
||||
|
||||
|
||||
//! \brief Display a warning message.
|
||||
inline void
|
||||
warning(const char* msg)
|
||||
{
|
||||
amd::report_warning(msg);
|
||||
}
|
||||
inline void warning(const char* msg) { amd::report_warning(msg); }
|
||||
|
||||
/*! \brief Abort the program with a "ShouldNotReachHere" message.
|
||||
* \hideinitializer
|
||||
@@ -102,66 +82,62 @@ warning(const char* msg)
|
||||
* \hideinitializer
|
||||
*/
|
||||
#ifndef NDEBUG
|
||||
# define Untested(msg) \
|
||||
warning("Untested(\"" msg "\")")
|
||||
#define Untested(msg) warning("Untested(\"" msg "\")")
|
||||
#else /*NDEBUG*/
|
||||
# define Untested(msg) (void)(0)
|
||||
#define Untested(msg) (void)(0)
|
||||
#endif /*NDEBUG*/
|
||||
|
||||
#ifdef DEBUG
|
||||
# define Log(level,msg) \
|
||||
do \
|
||||
{ \
|
||||
if (LOG_LEVEL >= level) { \
|
||||
amd::log_entry(level, __FILE__, __LINE__, msg); \
|
||||
} \
|
||||
} while (false)
|
||||
#else // !DEBUG
|
||||
# define Log(level,msg) (void)(0)
|
||||
#endif // !DEBUG
|
||||
#define Log(level, msg) \
|
||||
do { \
|
||||
if (LOG_LEVEL >= level) { \
|
||||
amd::log_entry(level, __FILE__, __LINE__, msg); \
|
||||
} \
|
||||
} while (false)
|
||||
#else // !DEBUG
|
||||
#define Log(level, msg) (void)(0)
|
||||
#endif // !DEBUG
|
||||
|
||||
#ifdef DEBUG
|
||||
# define LogTS(level,msg) \
|
||||
do \
|
||||
{ \
|
||||
if (LOG_LEVEL >= level) { \
|
||||
amd::log_timestamped(level, __FILE__, __LINE__, msg); \
|
||||
} \
|
||||
} while (false)
|
||||
#else // !DEBUG
|
||||
# define Log(level,msg) (void)(0)
|
||||
#endif // !DEBUG
|
||||
#define LogTS(level, msg) \
|
||||
do { \
|
||||
if (LOG_LEVEL >= level) { \
|
||||
amd::log_timestamped(level, __FILE__, __LINE__, msg); \
|
||||
} \
|
||||
} while (false)
|
||||
#else // !DEBUG
|
||||
#define Log(level, msg) (void)(0)
|
||||
#endif // !DEBUG
|
||||
|
||||
#ifdef DEBUG
|
||||
# define Logf(level, format, ...) \
|
||||
do \
|
||||
{ \
|
||||
if (LOG_LEVEL >= level) { \
|
||||
amd::log_printf(level, __FILE__, __LINE__, format, __VA_ARGS__); \
|
||||
} \
|
||||
} while (false)
|
||||
#else // !DEBUG
|
||||
# define Logf(level, format, ...) (void)(0)
|
||||
#endif // !DEBUG
|
||||
#define Logf(level, format, ...) \
|
||||
do { \
|
||||
if (LOG_LEVEL >= level) { \
|
||||
amd::log_printf(level, __FILE__, __LINE__, format, __VA_ARGS__); \
|
||||
} \
|
||||
} while (false)
|
||||
#else // !DEBUG
|
||||
#define Logf(level, format, ...) (void)(0)
|
||||
#endif // !DEBUG
|
||||
|
||||
#define CondLog(cond,msg) \
|
||||
do { \
|
||||
if (false DEBUG_ONLY(|| (cond))) { \
|
||||
Log(amd::LOG_INFO,msg); \
|
||||
} \
|
||||
} while (false)
|
||||
#define CondLog(cond, msg) \
|
||||
do { \
|
||||
if (false DEBUG_ONLY(|| (cond))) { \
|
||||
Log(amd::LOG_INFO, msg); \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
#define LogInfo(msg) Log(amd::LOG_INFO,msg)
|
||||
#define LogError(msg) Log(amd::LOG_ERROR,msg)
|
||||
#define LogWarning(msg) Log(amd::LOG_WARNING,msg)
|
||||
#define LogInfo(msg) Log(amd::LOG_INFO, msg)
|
||||
#define LogError(msg) Log(amd::LOG_ERROR, msg)
|
||||
#define LogWarning(msg) Log(amd::LOG_WARNING, msg)
|
||||
|
||||
#define LogTSInfo(msg) LogTS(amd::LOG_INFO,msg)
|
||||
#define LogTSError(msg) LogTS(amd::LOG_ERROR,msg)
|
||||
#define LogTSWarning(msg) LogTS(amd::LOG_WARNING,msg)
|
||||
#define LogTSInfo(msg) LogTS(amd::LOG_INFO, msg)
|
||||
#define LogTSError(msg) LogTS(amd::LOG_ERROR, msg)
|
||||
#define LogTSWarning(msg) LogTS(amd::LOG_WARNING, msg)
|
||||
|
||||
#define LogPrintfDebug(format, ...) Logf(amd::LOG_DEBUG, format, __VA_ARGS__)
|
||||
#define LogPrintfError(format, ...) Logf(amd::LOG_ERROR, format, __VA_ARGS__)
|
||||
#define LogPrintfWarning(format, ...) Logf(amd::LOG_WARNING, format, __VA_ARGS__)
|
||||
#define LogPrintfInfo(format, ...) Logf(amd::LOG_INFO, format, __VA_ARGS__)
|
||||
#define LogPrintfDebug(format, ...) Logf(amd::LOG_DEBUG, format, __VA_ARGS__)
|
||||
#define LogPrintfError(format, ...) Logf(amd::LOG_ERROR, format, __VA_ARGS__)
|
||||
#define LogPrintfWarning(format, ...) Logf(amd::LOG_WARNING, format, __VA_ARGS__)
|
||||
#define LogPrintfInfo(format, ...) Logf(amd::LOG_INFO, format, __VA_ARGS__)
|
||||
|
||||
#endif /*DEBUG_HPP_*/
|
||||
+105
-123
@@ -15,183 +15,165 @@
|
||||
#include <tchar.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif // !_WIN32
|
||||
#endif // !_WIN32
|
||||
|
||||
namespace {
|
||||
|
||||
const char* removeQuotes(const char* Value)
|
||||
{
|
||||
const char *b, *e, *p;
|
||||
if (Value == NULL) {
|
||||
return Value;
|
||||
}
|
||||
const char* removeQuotes(const char* Value) {
|
||||
const char *b, *e, *p;
|
||||
if (Value == NULL) {
|
||||
return Value;
|
||||
}
|
||||
|
||||
// skip the leading blank
|
||||
for (p = Value; *p == ' '; ++p);
|
||||
if (*p != '"') {
|
||||
return Value;
|
||||
}
|
||||
b = p;
|
||||
e = NULL;
|
||||
for (++p; *p != '\0'; ++p) {
|
||||
if (*p == '"') {
|
||||
// e points to the last '"'
|
||||
e = p;
|
||||
}
|
||||
else if ((e != NULL) && (*p != ' ')) {
|
||||
// e isn't last '"' if there is any non-blank following e
|
||||
e = NULL;
|
||||
}
|
||||
// skip the leading blank
|
||||
for (p = Value; *p == ' '; ++p)
|
||||
;
|
||||
if (*p != '"') {
|
||||
return Value;
|
||||
}
|
||||
b = p;
|
||||
e = NULL;
|
||||
for (++p; *p != '\0'; ++p) {
|
||||
if (*p == '"') {
|
||||
// e points to the last '"'
|
||||
e = p;
|
||||
} else if ((e != NULL) && (*p != ' ')) {
|
||||
// e isn't last '"' if there is any non-blank following e
|
||||
e = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (e == NULL) {
|
||||
return Value;
|
||||
}
|
||||
// Found a valid quoted string "<str>" with b=1st '"' and e=the last '"'
|
||||
size_t len = (e - b - 1) > 0 ? (e - b - 1) : 0;
|
||||
if (e == NULL) {
|
||||
return Value;
|
||||
}
|
||||
// Found a valid quoted string "<str>" with b=1st '"' and e=the last '"'
|
||||
size_t len = (e - b - 1) > 0 ? (e - b - 1) : 0;
|
||||
#ifdef _WIN32
|
||||
char* p1 = _strdup(b+1);
|
||||
p1[len] = '\0';
|
||||
p = p1;
|
||||
char* p1 = _strdup(b + 1);
|
||||
p1[len] = '\0';
|
||||
p = p1;
|
||||
#else
|
||||
p = strndup(b+1, len);
|
||||
p = strndup(b + 1, len);
|
||||
#endif
|
||||
return p;
|
||||
return p;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace amd {
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <crt_externs.h>
|
||||
#endif // __APPLE__
|
||||
#endif // __APPLE__
|
||||
|
||||
//static
|
||||
// static
|
||||
char* Flag::envstr_;
|
||||
|
||||
void Flag::tearDown()
|
||||
{
|
||||
|
||||
void Flag::tearDown() {
|
||||
#ifdef _WIN32
|
||||
FreeEnvironmentStringsA(envstr_);
|
||||
FreeEnvironmentStringsA(envstr_);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
bool
|
||||
Flag::init()
|
||||
{
|
||||
typedef std::map<std::string,const char*> vars_type;
|
||||
vars_type vars;
|
||||
bool Flag::init() {
|
||||
typedef std::map<std::string, const char*> vars_type;
|
||||
vars_type vars;
|
||||
|
||||
#ifdef _WIN32
|
||||
char* str = GetEnvironmentStringsA();
|
||||
envstr_ = str;
|
||||
char* str = GetEnvironmentStringsA();
|
||||
envstr_ = str;
|
||||
|
||||
for (; *str != '\0'; str += strlen(str) + 1) {
|
||||
// For all environment variables:
|
||||
std::string var = str;
|
||||
size_t pos = var.find('=');
|
||||
if ((pos == std::string::npos) || ((pos + 1) >= var.size())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string name = var.substr(0, pos);
|
||||
vars.insert(std::make_pair(name, &str[pos+1]));
|
||||
for (; *str != '\0'; str += strlen(str) + 1) {
|
||||
// For all environment variables:
|
||||
std::string var = str;
|
||||
size_t pos = var.find('=');
|
||||
if ((pos == std::string::npos) || ((pos + 1) >= var.size())) {
|
||||
continue;
|
||||
}
|
||||
#else // !_WIN32
|
||||
|
||||
std::string name = var.substr(0, pos);
|
||||
vars.insert(std::make_pair(name, &str[pos + 1]));
|
||||
}
|
||||
#else // !_WIN32
|
||||
#ifdef __APPLE__
|
||||
char** environ = *_NSGetEnviron();
|
||||
if (environ == NULL) { return false; }
|
||||
#endif // __APPLE__
|
||||
char** environ = *_NSGetEnviron();
|
||||
if (environ == NULL) {
|
||||
return false;
|
||||
}
|
||||
#endif // __APPLE__
|
||||
|
||||
for (const char** p = const_cast<const char**>(environ);*p != NULL; ++p) {
|
||||
std::string var = *p;
|
||||
size_t pos = var.find('=');
|
||||
if ((pos == std::string::npos) || ((pos + 1) >= var.size())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string name = var.substr(0, pos);
|
||||
vars.insert(std::make_pair(name, &(*p)[pos+1]));
|
||||
}
|
||||
#endif // !_WIN32
|
||||
|
||||
for (size_t i = 0; i < numFlags_; ++i) {
|
||||
Flag& flag = flags_[i];
|
||||
|
||||
vars_type::iterator it = vars.find(flag.name_);
|
||||
if (it != vars.end()) {
|
||||
flag.setValue(it->second);
|
||||
}
|
||||
for (const char** p = const_cast<const char**>(environ); *p != NULL; ++p) {
|
||||
std::string var = *p;
|
||||
size_t pos = var.find('=');
|
||||
if ((pos == std::string::npos) || ((pos + 1) >= var.size())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return true;
|
||||
std::string name = var.substr(0, pos);
|
||||
vars.insert(std::make_pair(name, &(*p)[pos + 1]));
|
||||
}
|
||||
#endif // !_WIN32
|
||||
|
||||
for (size_t i = 0; i < numFlags_; ++i) {
|
||||
Flag& flag = flags_[i];
|
||||
|
||||
vars_type::iterator it = vars.find(flag.name_);
|
||||
if (it != vars.end()) {
|
||||
flag.setValue(it->second);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
Flag::setValue(const char* value)
|
||||
{
|
||||
if (value_ == NULL) {
|
||||
return false; // flag is constant.
|
||||
}
|
||||
bool Flag::setValue(const char* value) {
|
||||
if (value_ == NULL) {
|
||||
return false; // flag is constant.
|
||||
}
|
||||
|
||||
isDefault_ = false;
|
||||
isDefault_ = false;
|
||||
|
||||
switch (type_) {
|
||||
switch (type_) {
|
||||
case Tbool:
|
||||
*(bool*) value_ = (strcmp(value, "true") == 0 || atoi(value) != 0) ? true : false;
|
||||
return true;
|
||||
*(bool*)value_ = (strcmp(value, "true") == 0 || atoi(value) != 0) ? true : false;
|
||||
return true;
|
||||
|
||||
case Tint:
|
||||
case Tuint:
|
||||
*(int*) value_ = atoi(value);
|
||||
return true;
|
||||
*(int*)value_ = atoi(value);
|
||||
return true;
|
||||
|
||||
case Tsize_t:
|
||||
*(size_t*) value_ = atol(value);
|
||||
return true;
|
||||
*(size_t*)value_ = atol(value);
|
||||
return true;
|
||||
|
||||
case Tcstring:
|
||||
*(const char**) value_ = removeQuotes(value);
|
||||
return true;
|
||||
*(const char**)value_ = removeQuotes(value);
|
||||
return true;
|
||||
|
||||
default: break;
|
||||
}
|
||||
ShouldNotReachHere();
|
||||
return false;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ShouldNotReachHere();
|
||||
return false;
|
||||
}
|
||||
|
||||
#define DEFINE_RELEASE_FLAG_STRUCT(type, name, value, help) \
|
||||
{ #name, &name, T##type, true },
|
||||
#define DEFINE_DEBUG_FLAG_STRUCT(type, name, value, help) \
|
||||
{ #name, RELEASE_ONLY(NULL) DEBUG_ONLY(&name), T##type, true },
|
||||
#define DEFINE_RELEASE_FLAG_STRUCT(type, name, value, help) {#name, &name, T##type, true},
|
||||
#define DEFINE_DEBUG_FLAG_STRUCT(type, name, value, help) \
|
||||
{#name, RELEASE_ONLY(NULL) DEBUG_ONLY(&name), T##type, true},
|
||||
|
||||
Flag
|
||||
Flag::flags_[] =
|
||||
{
|
||||
RUNTIME_FLAGS( \
|
||||
DEFINE_DEBUG_FLAG_STRUCT, \
|
||||
DEFINE_RELEASE_FLAG_STRUCT, \
|
||||
DEFINE_DEBUG_FLAG_STRUCT )
|
||||
{ NULL, NULL, Tinvalid, true }
|
||||
};
|
||||
Flag Flag::flags_[] = {
|
||||
RUNTIME_FLAGS(DEFINE_DEBUG_FLAG_STRUCT, DEFINE_RELEASE_FLAG_STRUCT, DEFINE_DEBUG_FLAG_STRUCT)
|
||||
{NULL, NULL, Tinvalid, true}};
|
||||
|
||||
#undef DEFINE_DEBUG_FLAG_STRUCT
|
||||
#undef DEFINE_RELEASE_FLAG_STRUCT
|
||||
|
||||
} // namespace amd
|
||||
} // namespace amd
|
||||
|
||||
#define DEFINE_RELEASE_FLAG_VALUE(type, name, value, help) type name = value;
|
||||
#define DEFINE_DEBUG_FLAG_VALUE(type, name, value, help) \
|
||||
DEBUG_ONLY(type name = value);
|
||||
#define DEFINE_DEBUG_FLAG_VALUE(type, name, value, help) DEBUG_ONLY(type name = value);
|
||||
|
||||
RUNTIME_FLAGS( \
|
||||
DEFINE_DEBUG_FLAG_VALUE, \
|
||||
DEFINE_RELEASE_FLAG_VALUE, \
|
||||
DEFINE_DEBUG_FLAG_VALUE );
|
||||
RUNTIME_FLAGS(DEFINE_DEBUG_FLAG_VALUE, DEFINE_RELEASE_FLAG_VALUE, DEFINE_DEBUG_FLAG_VALUE);
|
||||
|
||||
#undef DEFINE_DEBUG_FLAG_VALUE
|
||||
#undef DEFINE_RELEASE_FLAG_VALUE
|
||||
|
||||
@@ -213,62 +213,57 @@ namespace amd {
|
||||
//! \addtogroup Utils
|
||||
// @{
|
||||
|
||||
struct Flag
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
Tinvalid = 0,
|
||||
Tbool, //!< A boolean type flag (true, false).
|
||||
Tint, //!< An integer type flag (signed).
|
||||
Tuint, //!< An integer type flag (unsigned).
|
||||
Tsize_t, //!< A size_t type flag.
|
||||
Tcstring //!< A string type flag.
|
||||
};
|
||||
struct Flag {
|
||||
enum Type {
|
||||
Tinvalid = 0,
|
||||
Tbool, //!< A boolean type flag (true, false).
|
||||
Tint, //!< An integer type flag (signed).
|
||||
Tuint, //!< An integer type flag (unsigned).
|
||||
Tsize_t, //!< A size_t type flag.
|
||||
Tcstring //!< A string type flag.
|
||||
};
|
||||
|
||||
#define DEFINE_FLAG_NAME(type, name, value, help) k##name,
|
||||
enum Name
|
||||
{
|
||||
RUNTIME_FLAGS(DEFINE_FLAG_NAME, DEFINE_FLAG_NAME, DEFINE_FLAG_NAME)
|
||||
numFlags_
|
||||
};
|
||||
enum Name {
|
||||
RUNTIME_FLAGS(DEFINE_FLAG_NAME, DEFINE_FLAG_NAME, DEFINE_FLAG_NAME)
|
||||
numFlags_
|
||||
};
|
||||
#undef DEFINE_FLAG_NAME
|
||||
|
||||
#define CAN_SET(type, name, v, h) static const bool cannotSet##name = false;
|
||||
#define CANNOT_SET(type, name, v, h) static const bool cannotSet##name = true;
|
||||
|
||||
#ifdef DEBUG
|
||||
RUNTIME_FLAGS(CAN_SET, CAN_SET, CAN_SET)
|
||||
RUNTIME_FLAGS(CAN_SET, CAN_SET, CAN_SET)
|
||||
#else // !DEBUG
|
||||
RUNTIME_FLAGS(CANNOT_SET, CAN_SET, CANNOT_SET)
|
||||
RUNTIME_FLAGS(CANNOT_SET, CAN_SET, CANNOT_SET)
|
||||
#endif // !DEBUG
|
||||
|
||||
#undef CAN_SET
|
||||
#undef CANNOT_SET
|
||||
|
||||
private:
|
||||
private:
|
||||
static Flag flags_[];
|
||||
|
||||
static Flag flags_[];
|
||||
public:
|
||||
static char* envstr_;
|
||||
const char* name_;
|
||||
const void* value_;
|
||||
Type type_;
|
||||
bool isDefault_;
|
||||
|
||||
public:
|
||||
static char* envstr_;
|
||||
const char* name_;
|
||||
const void* value_;
|
||||
Type type_;
|
||||
bool isDefault_;
|
||||
public:
|
||||
static bool init();
|
||||
|
||||
public:
|
||||
static void tearDown();
|
||||
|
||||
static bool init();
|
||||
bool setValue(const char* value);
|
||||
|
||||
static void tearDown();
|
||||
|
||||
bool setValue(const char* value);
|
||||
|
||||
static bool isDefault(Name name) { return flags_[name].isDefault_; }
|
||||
static bool isDefault(Name name) { return flags_[name].isDefault_; }
|
||||
};
|
||||
|
||||
#define flagIsDefault(name) \
|
||||
(amd::Flag::cannotSet##name || amd::Flag::isDefault(amd::Flag::k##name))
|
||||
(amd::Flag::cannotSet##name || amd::Flag::isDefault(amd::Flag::k##name))
|
||||
|
||||
#define setIfNotDefault(var, opt, other) \
|
||||
if (!flagIsDefault(opt)) \
|
||||
|
||||
@@ -6,182 +6,178 @@
|
||||
#define MACROS_HPP_
|
||||
|
||||
#ifndef OPENCL_EXPORTS
|
||||
# define OPENCL_EXPORTS 1
|
||||
#endif // OPENCL_EXPORTS
|
||||
#define OPENCL_EXPORTS 1
|
||||
#endif // OPENCL_EXPORTS
|
||||
|
||||
#if defined(NDEBUG)
|
||||
# define RELEASE 1
|
||||
#else// !NDEBUG
|
||||
# define ASSERT 1
|
||||
# define DEBUG 1
|
||||
#endif // !NDEBUG
|
||||
#define RELEASE 1
|
||||
#else // !NDEBUG
|
||||
#define ASSERT 1
|
||||
#define DEBUG 1
|
||||
#endif // !NDEBUG
|
||||
|
||||
#if defined(_WIN64) && !defined(_LP64)
|
||||
# define _LP64 1
|
||||
#define _LP64 1
|
||||
#endif
|
||||
|
||||
#if defined(_DEBUG) && !defined(DEBUG)
|
||||
# define DEBUG 1
|
||||
#endif // _DEBUG && !DEBUG
|
||||
#define DEBUG 1
|
||||
#endif // _DEBUG && !DEBUG
|
||||
|
||||
#if defined(DEBUG) && defined(RELEASE)
|
||||
# error "Build Error: cannot have both -DDEBUG and -DRELEASE"
|
||||
#error "Build Error: cannot have both -DDEBUG and -DRELEASE"
|
||||
#endif /*DEBUG && RELEASE*/
|
||||
|
||||
#if !defined(DEBUG) && !defined(RELEASE)
|
||||
# error "Build Error: must have either -DDEBUG or -DRELEASE"
|
||||
#error "Build Error: must have either -DDEBUG or -DRELEASE"
|
||||
#endif /*DEBUG && RELEASE*/
|
||||
|
||||
#ifdef DEBUG
|
||||
# define DEBUG_ONLY(x) x
|
||||
# define RELEASE_ONLY(x)
|
||||
# define IS_DEBUG true
|
||||
#else // !DEBUG
|
||||
# define DEBUG_ONLY(x)
|
||||
# define RELEASE_ONLY(x) x
|
||||
# define IS_DEBUG false
|
||||
#define DEBUG_ONLY(x) x
|
||||
#define RELEASE_ONLY(x)
|
||||
#define IS_DEBUG true
|
||||
#else // !DEBUG
|
||||
#define DEBUG_ONLY(x)
|
||||
#define RELEASE_ONLY(x) x
|
||||
#define IS_DEBUG false
|
||||
#endif /*!DEBUG*/
|
||||
#define DEBUG_SWITCH(d,r) DEBUG_ONLY(d)RELEASE_ONLY(r)
|
||||
#define RELEASE_SWITCH(r,d) RELEASE_ONLY(r)DEBUG_ONLY(d)
|
||||
#define DEBUG_SWITCH(d, r) DEBUG_ONLY(d) RELEASE_ONLY(r)
|
||||
#define RELEASE_SWITCH(r, d) RELEASE_ONLY(r) DEBUG_ONLY(d)
|
||||
|
||||
//! \brief Make a c-string of __macro__
|
||||
#define STR(__macro__) #__macro__
|
||||
//! \brief Make a c-string of the expansion of __macro__
|
||||
#define XSTR(__macro__) STR(__macro__)
|
||||
//! \brief Concatenate 2 symbols
|
||||
#define CONCAT(a,b) a##b
|
||||
#define XCONCAT(a,b) CONCAT(a,b)
|
||||
#define CONCAT(a, b) a##b
|
||||
#define XCONCAT(a, b) CONCAT(a, b)
|
||||
|
||||
|
||||
//! \cond ignore
|
||||
#ifdef _LP64
|
||||
# define LP64_ONLY(x) x
|
||||
# define NOT_LP64(x)
|
||||
#else // !_LP64
|
||||
# define LP64_ONLY(x)
|
||||
# define NOT_LP64(x) x
|
||||
#define LP64_ONLY(x) x
|
||||
#define NOT_LP64(x)
|
||||
#else // !_LP64
|
||||
#define LP64_ONLY(x)
|
||||
#define NOT_LP64(x) x
|
||||
#endif /*!_LP64*/
|
||||
#define LP64_SWITCH(lp32,lp64) NOT_LP64(lp32)LP64_ONLY(lp64)
|
||||
#define LP64_SWITCH(lp32, lp64) NOT_LP64(lp32) LP64_ONLY(lp64)
|
||||
|
||||
#ifdef __linux__
|
||||
# define IS_LINUX true
|
||||
# define LINUX_ONLY(x) x
|
||||
# define NOT_LINUX(x)
|
||||
#else // !__linux__
|
||||
# define LINUX_ONLY(x)
|
||||
# define NOT_LINUX(x) x
|
||||
#define IS_LINUX true
|
||||
#define LINUX_ONLY(x) x
|
||||
#define NOT_LINUX(x)
|
||||
#else // !__linux__
|
||||
#define LINUX_ONLY(x)
|
||||
#define NOT_LINUX(x) x
|
||||
#endif /*!__linux__*/
|
||||
|
||||
#ifdef __APPLE__
|
||||
# define IS_MACOS true
|
||||
# define MACOS_ONLY(x) x
|
||||
# define NOT_MACOS(x)
|
||||
#else // !__APPLE__
|
||||
# define MACOS_ONLY(x)
|
||||
# define NOT_MACOS(x) x
|
||||
#define IS_MACOS true
|
||||
#define MACOS_ONLY(x) x
|
||||
#define NOT_MACOS(x)
|
||||
#else // !__APPLE__
|
||||
#define MACOS_ONLY(x)
|
||||
#define NOT_MACOS(x) x
|
||||
#endif /*!__APPLE__*/
|
||||
|
||||
#ifdef _WIN32
|
||||
# define IS_WINDOWS true
|
||||
# define WINDOWS_ONLY(x) x
|
||||
# define NOT_WINDOWS(x)
|
||||
#else // !_WIN32
|
||||
# define WINDOWS_ONLY(x)
|
||||
# define NOT_WINDOWS(x) x
|
||||
#define IS_WINDOWS true
|
||||
#define WINDOWS_ONLY(x) x
|
||||
#define NOT_WINDOWS(x)
|
||||
#else // !_WIN32
|
||||
#define WINDOWS_ONLY(x)
|
||||
#define NOT_WINDOWS(x) x
|
||||
#endif /*!_WIN32*/
|
||||
|
||||
#ifdef _WIN64
|
||||
# define WIN64_ONLY(x) x
|
||||
# define NOT_WIN64(x)
|
||||
#else // !_WIN64
|
||||
# define WIN64_ONLY(x)
|
||||
# define NOT_WIN64(x) x
|
||||
#define WIN64_ONLY(x) x
|
||||
#define NOT_WIN64(x)
|
||||
#else // !_WIN64
|
||||
#define WIN64_ONLY(x)
|
||||
#define NOT_WIN64(x) x
|
||||
#endif /*!_WIN64*/
|
||||
|
||||
#ifdef WITH_LIGHTNING_COMPILER
|
||||
# define LIGHTNING_ONLY(x) x
|
||||
# define IS_LIGHTNING true
|
||||
#define LIGHTNING_ONLY(x) x
|
||||
#define IS_LIGHTNING true
|
||||
#else /* !WITH_LIGHTNING_COMPILER */
|
||||
# define LIGHTNING_ONLY(x)
|
||||
#define LIGHTNING_ONLY(x)
|
||||
#endif /* !WITH_LIGHTNING_COMPILER */
|
||||
|
||||
#ifndef IS_LINUX
|
||||
# define IS_LINUX false
|
||||
#define IS_LINUX false
|
||||
#endif
|
||||
#ifndef IS_MACOS
|
||||
# define IS_MACOS false
|
||||
#define IS_MACOS false
|
||||
#endif
|
||||
#ifndef IS_WINDOWS
|
||||
# define IS_WINDOWS false
|
||||
#define IS_WINDOWS false
|
||||
#endif
|
||||
#ifndef IS_LIGHTNING
|
||||
# define IS_LIGHTNING false
|
||||
#define IS_LIGHTNING false
|
||||
#endif
|
||||
|
||||
#define IF_LEFT_true(x) x
|
||||
#define IF_LEFT_false(x)
|
||||
#define IF_RIGHT_true(x)
|
||||
#define IF_RIGHT_true(x)
|
||||
#define IF_RIGHT_false(x) x
|
||||
|
||||
#define IF_LEFT(cond,x) IF_LEFT_##cond(x)
|
||||
#define IF_RIGHT(cond,x) IF_RIGHT_##cond(x)
|
||||
#define IF(cond,x,y) IF_LEFT(cond,x)IF_RIGHT(cond,y)
|
||||
#define IF_LEFT(cond, x) IF_LEFT_##cond(x)
|
||||
#define IF_RIGHT(cond, x) IF_RIGHT_##cond(x)
|
||||
#define IF(cond, x, y) IF_LEFT(cond, x) IF_RIGHT(cond, y)
|
||||
|
||||
#define LINUX_SWITCH(x,other) LINUX_ONLY(x)NOT_LINUX(other)
|
||||
#define MACOS_SWITCH(x,other) MACOS_ONLY(x)NOT_MACOS(other)
|
||||
#define WINDOWS_SWITCH(x,other) WINDOWS_ONLY(x)NOT_WINDOWS(other)
|
||||
#define LINUX_SWITCH(x, other) LINUX_ONLY(x) NOT_LINUX(other)
|
||||
#define MACOS_SWITCH(x, other) MACOS_ONLY(x) NOT_MACOS(other)
|
||||
#define WINDOWS_SWITCH(x, other) WINDOWS_ONLY(x) NOT_WINDOWS(other)
|
||||
|
||||
#ifdef OPENCL_MAINLINE
|
||||
# define IS_MAINLINE true
|
||||
#else // OPENCL_STAGING
|
||||
# define IS_MAINLINE false
|
||||
#endif
|
||||
#define IS_MAINLINE true
|
||||
|
||||
#ifdef OPTIMIZED
|
||||
# define OPTIMIZED_ONLY(x) x
|
||||
# define NOT_OPTIMIZED(x)
|
||||
# define IS_OPTIMIZED true
|
||||
#define OPTIMIZED_ONLY(x) x
|
||||
#define NOT_OPTIMIZED(x)
|
||||
#define IS_OPTIMIZED true
|
||||
#else
|
||||
# define OPTIMIZED_ONLY(x)
|
||||
# define NOT_OPTIMIZED(x) x
|
||||
# define IS_OPTIMIZED false
|
||||
#define OPTIMIZED_ONLY(x)
|
||||
#define NOT_OPTIMIZED(x) x
|
||||
#define IS_OPTIMIZED false
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# define __ALIGNED__(x) __attribute__((aligned(x)))
|
||||
#define __ALIGNED__(x) __attribute__((aligned(x)))
|
||||
#elif defined(_MSC_VER)
|
||||
# define __ALIGNED__(x) __declspec(align(x))
|
||||
#define __ALIGNED__(x) __declspec(align(x))
|
||||
#elif defined(RC_INVOKED)
|
||||
# define __ALIGNED__(x)
|
||||
#define __ALIGNED__(x)
|
||||
#else
|
||||
# error
|
||||
#error
|
||||
#endif /*_MSC_VER*/
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# define likely(cond) __builtin_expect(!!(cond), 1)
|
||||
# define unlikely(cond) __builtin_expect(!!(cond), 0)
|
||||
#else // !__GNUC__
|
||||
# define likely(cond) (cond)
|
||||
# define unlikely(cond) (cond)
|
||||
#endif // !__GNUC__
|
||||
#define likely(cond) __builtin_expect(!!(cond), 1)
|
||||
#define unlikely(cond) __builtin_expect(!!(cond), 0)
|
||||
#else // !__GNUC__
|
||||
#define likely(cond) (cond)
|
||||
#define unlikely(cond) (cond)
|
||||
#endif // !__GNUC__
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# define NOINLINE __attribute__((noinline))
|
||||
# define ALWAYSINLINE __attribute__ ((always_inline))
|
||||
#define NOINLINE __attribute__((noinline))
|
||||
#define ALWAYSINLINE __attribute__((always_inline))
|
||||
#elif defined(_MSC_VER)
|
||||
# define NOINLINE __declspec(noinline)
|
||||
# define ALWAYSINLINE __forceinline
|
||||
#else // !_MSC_VER
|
||||
# define NOINLINE
|
||||
# define ALWAYSINLINE
|
||||
#endif // !_MSC_VER
|
||||
#define NOINLINE __declspec(noinline)
|
||||
#define ALWAYSINLINE __forceinline
|
||||
#else // !_MSC_VER
|
||||
#define NOINLINE
|
||||
#define ALWAYSINLINE
|
||||
#endif // !_MSC_VER
|
||||
|
||||
#ifdef BRAHMA
|
||||
# define IS_BRAHMA true
|
||||
#define IS_BRAHMA true
|
||||
#else
|
||||
# define IS_BRAHMA false
|
||||
#define IS_BRAHMA false
|
||||
#endif
|
||||
|
||||
//! \endcond
|
||||
|
||||
#endif // MACROS_HPP_
|
||||
#endif // MACROS_HPP_
|
||||
+87
-176
@@ -17,51 +17,31 @@ namespace amd {
|
||||
*/
|
||||
|
||||
//! \brief Check if the given value \a val is a power of 2.
|
||||
template <typename T>
|
||||
static inline bool
|
||||
isPowerOfTwo(T val)
|
||||
{
|
||||
return (val & (val - 1)) == 0;
|
||||
}
|
||||
template <typename T> static inline bool isPowerOfTwo(T val) { return (val & (val - 1)) == 0; }
|
||||
|
||||
//! \cond ignore
|
||||
|
||||
// Compute the next power of 2 helper.
|
||||
template <uint N>
|
||||
struct NextPowerOfTwoFunction
|
||||
{
|
||||
template <typename T>
|
||||
static T compute(T val)
|
||||
{
|
||||
val = NextPowerOfTwoFunction<N/2>::compute(val);
|
||||
return (val >> N) | val;
|
||||
}
|
||||
template <uint N> struct NextPowerOfTwoFunction {
|
||||
template <typename T> static T compute(T val) {
|
||||
val = NextPowerOfTwoFunction<N / 2>::compute(val);
|
||||
return (val >> N) | val;
|
||||
}
|
||||
};
|
||||
|
||||
// Specialized version for <1> to break the recursion.
|
||||
template <>
|
||||
struct NextPowerOfTwoFunction<1>
|
||||
{
|
||||
template <typename T>
|
||||
static T compute(T val) { return (val >> 1) | val; }
|
||||
template <> struct NextPowerOfTwoFunction<1> {
|
||||
template <typename T> static T compute(T val) { return (val >> 1) | val; }
|
||||
};
|
||||
|
||||
template <uint N, int S>
|
||||
struct NextPowerOfTwoHelper
|
||||
{
|
||||
static const uint prev = NextPowerOfTwoHelper<N, S / 2>::value;
|
||||
static const uint value = (prev >> S) | prev;
|
||||
};
|
||||
template <uint N>
|
||||
struct NextPowerOfTwoHelper<N, 1>
|
||||
{
|
||||
static const int value = (N >> 1) | N;
|
||||
template <uint N, int S> struct NextPowerOfTwoHelper {
|
||||
static const uint prev = NextPowerOfTwoHelper<N, S / 2>::value;
|
||||
static const uint value = (prev >> S) | prev;
|
||||
};
|
||||
template <uint N> struct NextPowerOfTwoHelper<N, 1> { static const int value = (N >> 1) | N; };
|
||||
|
||||
template <uint N>
|
||||
struct NextPowerOfTwo
|
||||
{
|
||||
static const uint value = NextPowerOfTwoHelper<N-1, 16>::value + 1;
|
||||
template <uint N> struct NextPowerOfTwo {
|
||||
static const uint value = NextPowerOfTwoHelper<N - 1, 16>::value + 1;
|
||||
};
|
||||
|
||||
//! \endcond
|
||||
@@ -78,26 +58,15 @@ struct NextPowerOfTwo
|
||||
*
|
||||
* The next power of two is: 1+compute(val-1)
|
||||
*/
|
||||
template <typename T>
|
||||
inline T
|
||||
nextPowerOfTwo(T val)
|
||||
{
|
||||
return NextPowerOfTwoFunction<sizeof(T)*4>::compute(val - 1) + 1;
|
||||
template <typename T> inline T nextPowerOfTwo(T val) {
|
||||
return NextPowerOfTwoFunction<sizeof(T) * 4>::compute(val - 1) + 1;
|
||||
}
|
||||
|
||||
// Compute log2(N)
|
||||
template <uint N>
|
||||
struct Log2
|
||||
{
|
||||
static const uint value = Log2<N/2>::value + 1;
|
||||
};
|
||||
template <uint N> struct Log2 { static const uint value = Log2<N / 2>::value + 1; };
|
||||
|
||||
// Break the recursion
|
||||
template <>
|
||||
struct Log2<1>
|
||||
{
|
||||
static const uint value = 0;
|
||||
};
|
||||
template <> struct Log2<1> { static const uint value = 0; };
|
||||
|
||||
/*! \brief Return the log2 for a value of type T.
|
||||
*
|
||||
@@ -111,177 +80,120 @@ struct Log2<1>
|
||||
* if (val >= 1 << 1) { l |= 1; }
|
||||
* return l;
|
||||
*/
|
||||
template <uint N>
|
||||
struct Log2Function
|
||||
{
|
||||
template <typename T>
|
||||
static uint compute(T val)
|
||||
{
|
||||
uint l = 0;
|
||||
if (val >= T(1) << N) {
|
||||
val >>= N; l = N;
|
||||
}
|
||||
return l + Log2Function<N/2>::compute(val);
|
||||
template <uint N> struct Log2Function {
|
||||
template <typename T> static uint compute(T val) {
|
||||
uint l = 0;
|
||||
if (val >= T(1) << N) {
|
||||
val >>= N;
|
||||
l = N;
|
||||
}
|
||||
return l + Log2Function<N / 2>::compute(val);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Log2Function<1>
|
||||
{
|
||||
template <typename T>
|
||||
static uint compute(T val) {
|
||||
return (val >= T(1)<<1) ? 1 : 0;
|
||||
}
|
||||
template <> struct Log2Function<1> {
|
||||
template <typename T> static uint compute(T val) { return (val >= T(1) << 1) ? 1 : 0; }
|
||||
};
|
||||
|
||||
// log2 helper function
|
||||
template <typename T>
|
||||
inline uint
|
||||
log2(T val)
|
||||
{
|
||||
return Log2Function<sizeof(T)*4>::compute(val);
|
||||
template <typename T> inline uint log2(T val) { return Log2Function<sizeof(T) * 4>::compute(val); }
|
||||
|
||||
template <typename T> inline T alignDown(T value, size_t alignment) {
|
||||
return (T)(value & ~(alignment - 1));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T
|
||||
alignDown(T value, size_t alignment)
|
||||
{
|
||||
return (T) (value & ~(alignment - 1));
|
||||
template <typename T> inline T* alignDown(T* value, size_t alignment) {
|
||||
return (T*)alignDown((intptr_t)value, alignment);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T*
|
||||
alignDown(T* value, size_t alignment)
|
||||
{
|
||||
return (T*) alignDown((intptr_t) value, alignment);
|
||||
template <typename T> inline T alignUp(T value, size_t alignment) {
|
||||
return alignDown((T)(value + alignment - 1), alignment);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T
|
||||
alignUp(T value, size_t alignment)
|
||||
{
|
||||
return alignDown((T) (value + alignment - 1), alignment);
|
||||
template <typename T> inline T* alignUp(T* value, size_t alignment) {
|
||||
return (T*)alignDown((intptr_t)(value + alignment - 1), alignment);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T*
|
||||
alignUp(T* value, size_t alignment)
|
||||
{
|
||||
return (T*) alignDown((intptr_t) (value + alignment - 1), alignment);
|
||||
template <typename T> inline bool isMultipleOf(T value, size_t alignment) {
|
||||
if (isPowerOfTwo(alignment)) {
|
||||
// fast path, using logical operators
|
||||
return alignUp(value, alignment) == value;
|
||||
}
|
||||
return value % alignment == 0;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline bool isMultipleOf(T value, size_t alignment)
|
||||
{
|
||||
if (isPowerOfTwo(alignment)) {
|
||||
// fast path, using logical operators
|
||||
return alignUp(value, alignment) == value;
|
||||
}
|
||||
return value % alignment == 0;
|
||||
template <typename T> inline bool isMultipleOf(T* value, size_t alignment) {
|
||||
intptr_t ptr = reinterpret_cast<intptr_t>(value);
|
||||
return isMultipleOf(ptr, alignment);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline bool isMultipleOf(T* value, size_t alignment)
|
||||
{
|
||||
intptr_t ptr = reinterpret_cast<intptr_t>(value);
|
||||
return isMultipleOf(ptr, alignment);
|
||||
}
|
||||
|
||||
template <class Reference, class Value>
|
||||
struct DeviceMap {
|
||||
Reference ref_;
|
||||
Value value_;
|
||||
template <class Reference, class Value> struct DeviceMap {
|
||||
Reference ref_;
|
||||
Value value_;
|
||||
};
|
||||
|
||||
|
||||
inline uint
|
||||
countBitsSet32(uint32_t value)
|
||||
{
|
||||
inline uint countBitsSet32(uint32_t value) {
|
||||
#if __GNUC__ >= 4
|
||||
return (uint)__builtin_popcount(value);
|
||||
return (uint)__builtin_popcount(value);
|
||||
#else
|
||||
value = value - ((value >> 1) & 0x55555555);
|
||||
value = (value & 0x33333333) + ((value >> 2) & 0x33333333);
|
||||
return (uint)(((value + (value >> 4) & 0xF0F0F0F) * 0x1010101) >> 24);
|
||||
value = value - ((value >> 1) & 0x55555555);
|
||||
value = (value & 0x33333333) + ((value >> 2) & 0x33333333);
|
||||
return (uint)(((value + (value >> 4) & 0xF0F0F0F) * 0x1010101) >> 24);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline uint
|
||||
countBitsSet64(uint64_t value)
|
||||
{
|
||||
inline uint countBitsSet64(uint64_t value) {
|
||||
#if __GNUC__ >= 4
|
||||
return (uint)__builtin_popcountll(value);
|
||||
return (uint)__builtin_popcountll(value);
|
||||
#else
|
||||
value = value - ((value >> 1) & 0x5555555555555555ULL);
|
||||
value = (value & 0x3333333333333333ULL) + ((value >> 2) & 0x3333333333333333ULL);
|
||||
value = (value + (value >> 4)) & 0x0F0F0F0F0F0F0F0FULL;
|
||||
return (uint)((uint64_t)(value * 0x0101010101010101ULL) >> 56);
|
||||
value = value - ((value >> 1) & 0x5555555555555555ULL);
|
||||
value = (value & 0x3333333333333333ULL) + ((value >> 2) & 0x3333333333333333ULL);
|
||||
value = (value + (value >> 4)) & 0x0F0F0F0F0F0F0F0FULL;
|
||||
return (uint)((uint64_t)(value * 0x0101010101010101ULL) >> 56);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline uint
|
||||
leastBitSet32(uint32_t value)
|
||||
{
|
||||
inline uint leastBitSet32(uint32_t value) {
|
||||
#if defined(_WIN32)
|
||||
unsigned long idx;
|
||||
return _BitScanForward(&idx, (unsigned long)value) ? idx : (uint)-1;
|
||||
unsigned long idx;
|
||||
return _BitScanForward(&idx, (unsigned long)value) ? idx : (uint)-1;
|
||||
#else
|
||||
return value ? __builtin_ctz(value) : (uint)-1;
|
||||
return value ? __builtin_ctz(value) : (uint)-1;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline uint
|
||||
leastBitSet64(uint64_t value)
|
||||
{
|
||||
inline uint leastBitSet64(uint64_t value) {
|
||||
#if defined(_WIN64)
|
||||
unsigned long idx;
|
||||
return _BitScanForward64(&idx, (unsigned __int64)value) ? idx : (uint)-1;
|
||||
#elif defined (__GNUC__)
|
||||
return value ? __builtin_ctzll(value) : (uint)-1;
|
||||
unsigned long idx;
|
||||
return _BitScanForward64(&idx, (unsigned __int64)value) ? idx : (uint)-1;
|
||||
#elif defined(__GNUC__)
|
||||
return value ? __builtin_ctzll(value) : (uint)-1;
|
||||
#else
|
||||
static const uint8_t lookup67[67+1] = {
|
||||
64, 0, 1, 39, 2, 15, 40, 23,
|
||||
3, 12, 16, 59, 41, 19, 24, 54,
|
||||
4, -1, 13, 10, 17, 62, 60, 28,
|
||||
42, 30, 20, 51, 25, 44, 55, 47,
|
||||
5, 32, -1, 38, 14, 22, 11, 58,
|
||||
18, 53, 63, 9, 61, 27, 29, 50,
|
||||
43, 46, 31, 37, 21, 57, 52, 8,
|
||||
26, 49, 45, 36, 56, 7, 48, 35,
|
||||
6, 34, 33, -1
|
||||
};
|
||||
static const uint8_t lookup67[67 + 1] = {
|
||||
64, 0, 1, 39, 2, 15, 40, 23, 3, 12, 16, 59, 41, 19, 24, 54, 4, -1, 13, 10, 17, 62, 60,
|
||||
28, 42, 30, 20, 51, 25, 44, 55, 47, 5, 32, -1, 38, 14, 22, 11, 58, 18, 53, 63, 9, 61, 27,
|
||||
29, 50, 43, 46, 31, 37, 21, 57, 52, 8, 26, 49, 45, 36, 56, 7, 48, 35, 6, 34, 33, -1};
|
||||
|
||||
return (uint)lookup67[((int64_t)value & -(int64_t)value) % 67];
|
||||
return (uint)lookup67[((int64_t)value & -(int64_t)value) % 67];
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline uint countBitsSet(T value)
|
||||
{
|
||||
return (sizeof(T) == 8) ? countBitsSet64((uint64_t)value) :
|
||||
countBitsSet32((uint32_t)value);
|
||||
template <typename T> inline uint countBitsSet(T value) {
|
||||
return (sizeof(T) == 8) ? countBitsSet64((uint64_t)value) : countBitsSet32((uint32_t)value);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline uint leastBitSet(T value)
|
||||
{
|
||||
return (sizeof(T) == 8) ? leastBitSet64((uint64_t)value) :
|
||||
leastBitSet32((uint32_t)value);
|
||||
template <typename T> inline uint leastBitSet(T value) {
|
||||
return (sizeof(T) == 8) ? leastBitSet64((uint64_t)value) : leastBitSet32((uint32_t)value);
|
||||
}
|
||||
|
||||
static inline bool Is32Bits() {
|
||||
return LP64_SWITCH(true, false);
|
||||
}
|
||||
static inline bool Is32Bits() { return LP64_SWITCH(true, false); }
|
||||
|
||||
static inline bool Is64Bits() {
|
||||
return LP64_SWITCH(false, true);
|
||||
}
|
||||
static inline bool Is64Bits() { return LP64_SWITCH(false, true); }
|
||||
|
||||
template <typename lambda>
|
||||
class ScopeGuard {
|
||||
template <typename lambda> class ScopeGuard {
|
||||
public:
|
||||
explicit ALWAYSINLINE ScopeGuard(const lambda& release)
|
||||
: release_(release), dismiss_(false) {}
|
||||
explicit ALWAYSINLINE ScopeGuard(const lambda& release) : release_(release), dismiss_(false) {}
|
||||
|
||||
ScopeGuard(ScopeGuard& rhs) { *this = rhs; }
|
||||
|
||||
@@ -300,12 +212,11 @@ class ScopeGuard {
|
||||
bool dismiss_;
|
||||
};
|
||||
|
||||
#define MAKE_SCOPE_GUARD_HELPER(lname, sname, ...) \
|
||||
auto lname = __VA_ARGS__; \
|
||||
#define MAKE_SCOPE_GUARD_HELPER(lname, sname, ...) \
|
||||
auto lname = __VA_ARGS__; \
|
||||
amd::ScopeGuard<decltype(lname)> sname(lname);
|
||||
#define MAKE_SCOPE_GUARD(name, ...) \
|
||||
MAKE_SCOPE_GUARD_HELPER(XCONCAT(scopeGuardLambda, __COUNTER__), name, \
|
||||
__VA_ARGS__)
|
||||
#define MAKE_SCOPE_GUARD(name, ...) \
|
||||
MAKE_SCOPE_GUARD_HELPER(XCONCAT(scopeGuardLambda, __COUNTER__), name, __VA_ARGS__)
|
||||
|
||||
/*@}*/} // namespace amd
|
||||
|
||||
|
||||
@@ -8,27 +8,29 @@
|
||||
#include "utils/macros.hpp"
|
||||
|
||||
#ifndef AMD_PLATFORM_NAME
|
||||
# define AMD_PLATFORM_NAME "AMD Accelerated Parallel Processing"
|
||||
#endif // AMD_PLATFORM_NAME
|
||||
#define AMD_PLATFORM_NAME "AMD Accelerated Parallel Processing"
|
||||
#endif // AMD_PLATFORM_NAME
|
||||
|
||||
#ifndef AMD_PLATFORM_BUILD_NUMBER
|
||||
# define AMD_PLATFORM_BUILD_NUMBER 2403
|
||||
#endif // AMD_PLATFORM_BUILD_NUMBER
|
||||
#define AMD_PLATFORM_BUILD_NUMBER 2403
|
||||
#endif // AMD_PLATFORM_BUILD_NUMBER
|
||||
|
||||
#ifndef AMD_PLATFORM_REVISION_NUMBER
|
||||
# define AMD_PLATFORM_REVISION_NUMBER 0
|
||||
#endif // AMD_PLATFORM_REVISION_NUMBER
|
||||
#define AMD_PLATFORM_REVISION_NUMBER 0
|
||||
#endif // AMD_PLATFORM_REVISION_NUMBER
|
||||
|
||||
#ifndef AMD_PLATFORM_RELEASE_INFO
|
||||
# define AMD_PLATFORM_RELEASE_INFO
|
||||
#endif // AMD_PLATFORM_RELEASE_INFO
|
||||
#define AMD_PLATFORM_RELEASE_INFO
|
||||
#endif // AMD_PLATFORM_RELEASE_INFO
|
||||
|
||||
#define AMD_BUILD_STRING XSTR(AMD_PLATFORM_BUILD_NUMBER) \
|
||||
"." XSTR(AMD_PLATFORM_REVISION_NUMBER)
|
||||
#define AMD_BUILD_STRING \
|
||||
XSTR(AMD_PLATFORM_BUILD_NUMBER) \
|
||||
"." XSTR(AMD_PLATFORM_REVISION_NUMBER)
|
||||
|
||||
#ifndef AMD_PLATFORM_INFO
|
||||
# define AMD_PLATFORM_INFO "AMD-APP" AMD_PLATFORM_RELEASE_INFO \
|
||||
DEBUG_ONLY("." IF(IS_OPTIMIZED,"opt","dbg")) " (" AMD_BUILD_STRING ")"
|
||||
#endif // ATI_PLATFORM_INFO
|
||||
#define AMD_PLATFORM_INFO \
|
||||
"AMD-APP" AMD_PLATFORM_RELEASE_INFO DEBUG_ONLY( \
|
||||
"." IF(IS_OPTIMIZED, "opt", "dbg")) " (" AMD_BUILD_STRING ")"
|
||||
#endif // ATI_PLATFORM_INFO
|
||||
|
||||
#endif // VERSIONS_HPP_
|
||||
#endif // VERSIONS_HPP_
|
||||
Reference in new issue
Block a user