Commit 53870e3b authored by Paul's avatar Paul
Browse files

Add more asserts

parent b7902fa7
...@@ -72,7 +72,7 @@ inline __device__ __attribute__((const)) index_int compute_local_size() ...@@ -72,7 +72,7 @@ inline __device__ __attribute__((const)) index_int compute_local_size()
#ifdef MIGRAPHX_NGROUP #ifdef MIGRAPHX_NGROUP
// If global is divisible by local then local can be a const // If global is divisible by local then local can be a const
#if(MIGRAPHX_NGLOBAL % MIGRAPHX_NLOCAL == 0) || (MIGRAPHX_NGROUP == 1) #if(MIGRAPHX_NGLOBAL % MIGRAPHX_NLOCAL == 0) || (MIGRAPHX_NGROUP == 1)
#define MIGRAPHX_CONST_LOCAL 1 #define MIGRAPHX_HAS_CONST_LOCAL 1
#endif #endif
#endif #endif
...@@ -87,6 +87,7 @@ struct index ...@@ -87,6 +87,7 @@ struct index
#else #else
__device__ index_int nglobal() const __device__ index_int nglobal() const
{ {
MIGRAPHX_ASSERT(compute_global_size() > 0);
return compute_global_size(); // NOLINT return compute_global_size(); // NOLINT
} }
#endif #endif
...@@ -96,6 +97,10 @@ struct index ...@@ -96,6 +97,10 @@ struct index
#else #else
__device__ index_int nlocal() const __device__ index_int nlocal() const
{ {
#ifdef MIGRAPHX_NGROUP
static_assert((MIGRAPHX_NGLOBAL % MIGRAPHX_NLOCAL != 0) and (MIGRAPHX_NGROUP > 1), "Local should be const");
#endif
MIGRAPHX_ASSERT(compute_local_size() > 0);
return compute_local_size(); // NOLINT return compute_local_size(); // NOLINT
} }
#endif #endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment