- Don't pass uint32_t arguments by reference.
- Use nullptr instead of NULL.
- Don't add frivolous typedefs.
- Use correct types when available instead of generic integral types.
- Make all roctracer callbacks extern "C" to prepare for a future change
that will be removing their declaration from hip_runtime_api.h.
- Rename cb/sem sync and release functions -> reader_lock/writer_lock
acquire and release.
Change-Id: If203fee077d421a9782fcd34607a413b8c3dcfc8
[ROCm/clr commit: 9f09ca929e]
When acquiring the reader's lock (sem_sync()...sem_release()), it is
possible for a writer to squeeze by if the reader goes into sync_wait().
The writer could re-acquire the entry.sync between entry.sem > 0 and
entry.sync = 0.
void sync_wait(uint32_t id) {
sem_decrement(id);
while (entry(id).sync.load()) {}
// <--- HERE
sem_increment(id);
}
This could result in both the reader and the writer accessing
{ callback, arg } at the same time, and the reader could read
inconsistent data, for example: { new callback, old arg }.
The solution is to re-test entry.sync when returning from sync_wait():
void sem_sync(uint32_t id) {
sem_increment(id);
- if (entry(id).sync.load() == true) sync_wait(id);
+ while (entry(id).sync.load() == true) sync_wait(id);
}
Change-Id: I22f74f4cb9a5f027aac8aa4ed3e633acc19df4b8
[ROCm/clr commit: 6f78083f2a]
Terse static_assert is only available starting with c++17. Add the
message argument since HIP is not compiled using c++17.
Change-Id: I77bc7ddb635e50ac3e6744d73c8751dc8299087e
[ROCm/clr commit: 73ee1afb17]
This change addresses the rocprofiler and HIP backward compatibility
issues. Before this patch, each time the hip_prof_str.h header was
generated, the ordering of the callbacks IDs changed, causing
incompatibilities between tools compiled with the old header and
runtimes compiled with the new headers (or vice versa).
To make the API callback IDs stable, the previous version of the header
is read to extract the enum values so that the same values can be
assigned in the new header.
Also, to make diffing different versions of the hip_prof_str.h easier
to read, all other sections (types, macros, helper functions) are now
alphabetically ordered.
If an update to the checked-in hip_prof_str.h file is required, the
cmake build is aborted and a message printed on stderr. The build will
not be successful until the checked-in hip_prof_str.h and the generated
hip_prof_str.h match.
Change-Id: I38b920e601185f7365a76a6584df91a7e8a11798
[ROCm/clr commit: d208afcb36]
In file included from /extra/lmoriche/hip-vdi/hip/rocclr/hip_internal.hpp:25,
from /extra/lmoriche/hip-vdi/hip/rocclr/hip_hmm.cpp:22:
/extra/lmoriche/hip-vdi/hip/rocclr/hip_prof_api.h: In constructor ‘api_callbacks_table_t::api_callbacks_table_t()’:
/extra/lmoriche/hip-vdi/hip/rocclr/hip_prof_api.h:72:59: warning: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct api_callbacks_table_t::hip_cb_table_t’ with no trivial copy-assignment; use value-initialization instead [-Wclass-memaccess]
72 | memset(&callbacks_table_, 0, sizeof(callbacks_table_));
| ^
/extra/lmoriche/hip-vdi/hip/rocclr/hip_prof_api.h:67:10: note: ‘struct api_callbacks_table_t::hip_cb_table_t’ declared here
67 | struct hip_cb_table_t {
| ^~~~~~~~~~~~~~
Address the above warning by providing default initialization of the
api_callbacks_table_t::hip_cb_table_t class members.
Change-Id: I69ea7c390c28cf3f8aec57f23566d6a3061a0365
[ROCm/clr commit: 0f7a47a95f]
Remove hip-hcc codes from hip code base
Simplify hip CMakeLists.txt to exclude hip-hcc
Simplify cmake cmd for hip-rocclr building
Some minor fixes
Change-Id: I1ae357ecfd638d6c25bca293c1724b026be21ecd
[ROCm/clr commit: 1cba7ec965]