Support public apis for cooperative group types.

Change-Id: I01346afde485e82c34b7868b9241b34c542d0cf9
This commit is contained in:
mshivama
2020-08-09 13:30:08 +05:30
parent 5fb155dbf5
commit bfb54cc5e9
10 changed files with 1670 additions and 98 deletions
@@ -230,7 +230,8 @@ __CG_QUALIFIER__ uint32_t thread_group::thread_rank() const {
return (static_cast<const thread_block*>(this)->thread_rank());
}
default: {
return 0; //TODO(mahesha)
assert(false && "invalid cooperative group type");
return -1;
}
}
}
@@ -247,6 +248,7 @@ __CG_QUALIFIER__ bool thread_group::is_valid() const {
return (static_cast<const thread_block*>(this)->is_valid());
}
default: {
assert(false && "invalid cooperative group type");
return false;
}
}
@@ -266,9 +268,36 @@ __CG_QUALIFIER__ void thread_group::sync() const {
static_cast<const thread_block*>(this)->sync();
break;
}
default: {
assert(false && "invalid cooperative group type");
}
}
}
/**
* Implemenation of publicly exposed `wrapper` APIs on top of basic cooperative
* group type APIs
*/
template <class CGTy>
__CG_QUALIFIER__ uint32_t group_size(CGTy const &g) {
return g.size();
}
template <class CGTy>
__CG_QUALIFIER__ uint32_t thread_rank(CGTy const &g) {
return g.thread_rank();
}
template <class CGTy>
__CG_QUALIFIER__ bool is_valid(CGTy const &g) {
return g.is_valid();
}
template <class CGTy>
__CG_QUALIFIER__ void sync(CGTy const &g) {
g.sync();
}
} // namespace cooperative_groups
#endif // __cplusplus