Loading...
Searching...
No Matches
4#include <muda/tools/fuzzy.h>
5#include <muda/assert.h>
7#include <muda/muda_config.h>
8#include <muda/muda_def.h>
11#define MUDA_KERNEL_PRINT(fmt, ...) \
13 if(muda::block_dim().y == 1 && muda::block_dim().z == 1) \
15 ::muda::print("(%d|%d)-(%d|%d):" fmt "\n", \
16 muda::block_idx().x, \
18 muda::thread_idx().x, \
19 muda::block_dim().x, \
22 else if(muda::block_dim().z == 1) \
24 ::muda::print("(%d|%d,%d|%d)-(%d|%d,%d|%d):" fmt "\n", \
25 muda::block_idx().x, \
27 muda::block_idx().y, \
29 muda::thread_idx().x, \
30 muda::block_dim().x, \
31 muda::thread_idx().y, \
32 muda::block_dim().y, \
37 ::muda::print("(%d|%d,%d|%d,%d|%d)-(%d|%d,%d|%d,%d|%d):" fmt "\n", \
38 muda::block_idx().x, \
40 muda::block_idx().y, \
42 muda::block_idx().z, \
44 muda::thread_idx().x, \
45 muda::block_dim().x, \
46 muda::thread_idx().y, \
47 muda::block_dim().y, \
48 muda::thread_idx().z, \
49 muda::block_dim().z, \
54#define MUDA_KERNEL_PRINT(fmt, ...) \
56 ::muda::print("(host):" fmt "\n", ##__VA_ARGS__); \
61#define MUDA_DEBUG_TRAP() \
63 if constexpr(::muda::TRAP_ON_ERROR) \
69#define MUDA_KERNEL_ASSERT(res, fmt, ...) \
71 if constexpr(::muda::RUNTIME_CHECK_ON) \
75 MUDA_KERNEL_PRINT("%s(%d): %s:\n <assert> " #res " failed. " fmt, \
86#define MUDA_KERNEL_CHECK(res, fmt, ...) \
88 if constexpr(::muda::RUNTIME_CHECK_ON) \
92 MUDA_KERNEL_PRINT("%s(%d): %s:\n <check> " #res " failed. " fmt, \
102#define MUDA_KERNEL_ERROR(fmt, ...) \
104 MUDA_KERNEL_PRINT("<error> " fmt, ##__VA_ARGS__); \
108#define MUDA_KERNEL_ERROR_WITH_LOCATION(fmt, ...) \
110 MUDA_KERNEL_PRINT("%s(%d): %s:\n <error> " fmt, __FILE__, __LINE__, MUDA_FUNCTION_SIG, ##__VA_ARGS__); \
115#define MUDA_KERNEL_WARN(fmt, ...) \
117 MUDA_KERNEL_PRINT("<warn>" fmt, ##__VA_ARGS__); \
120#define MUDA_KERNEL_WARN_WITH_LOCATION(fmt, ...) \
122 MUDA_KERNEL_PRINT("%s(%d): %s:\n <warn>" fmt, __FILE__, __LINE__, MUDA_FUNCTION_SIG, ##__VA_ARGS__); \
126#define MUDA_ASSERT(res, fmt, ...) MUDA_KERNEL_ASSERT(res, fmt, ##__VA_ARGS__)
128#define MUDA_ERROR(fmt, ...) MUDA_KERNEL_ERROR(fmt, ##__VA_ARGS__)
130#define MUDA_ERROR_WITH_LOCATION(fmt, ...) MUDA_KERNEL_ERROR_WITH_LOCATION(fmt, ##__VA_ARGS__)