Skip to content

Commit 74c3df6

Browse files
committed
[Comgr] Turn DEVICE_LIBS_ID into an unsigned char
`char` may be signed or unsigned depending on the platfrom. Using `unsigned char` guarantees consistency across all the platforms, plus it doesn't need conversion from the digest() python method).
1 parent d5f3852 commit 74c3df6

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

amd/comgr/cmake/device-libs-id.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,5 @@
1515
for x in args.headers:
1616
hash.update(open(x, 'rb').read())
1717
digest_uchar = hash.digest()
18-
digest_char = [e if e < 128 else e-256 for e in digest_uchar]
19-
digest_elts = ", ".join(map(str, digest_char))
20-
print(f"static const char {args.varname}[] = {{{digest_elts}, 0}};", file=open(args.output, 'w'))
18+
digest_elts = ", ".join(map(str, digest_uchar))
19+
print(f"static const unsigned char {args.varname}[] = {{{digest_elts}, 0}};", file=open(args.output, 'w'))

amd/comgr/src/comgr-cache-command.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ CachedCommandAdaptor::getIdentifier() const {
8787
H.update(env::shouldEmitVerboseLogs());
8888
addString(H, getClangFullVersion());
8989
addString(H, getComgrHashIdentifier());
90-
addString(H, getDeviceLibrariesIdentifier());
90+
H.update(getDeviceLibrariesIdentifier());
9191

9292
if (Error E = addInputIdentifier(H))
9393
return E;

amd/comgr/src/comgr-device-libs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ amd_comgr_status_t addObject(DataSet *DataSet, amd_comgr_data_kind_t Kind,
6666
#include "opencl2.0-c.inc"
6767
} // namespace
6868

69-
StringRef getDeviceLibrariesIdentifier() { return DEVICE_LIBS_ID; }
69+
ArrayRef<unsigned char> getDeviceLibrariesIdentifier() { return DEVICE_LIBS_ID; }
7070

7171
amd_comgr_status_t addPrecompiledHeaders(DataAction *ActionInfo,
7272
DataSet *ResultSet) {

amd/comgr/src/comgr-device-libs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct DataSet;
4949
amd_comgr_status_t addPrecompiledHeaders(DataAction *ActionInfo,
5050
DataSet *ResultSet);
5151

52-
llvm::StringRef getDeviceLibrariesIdentifier();
52+
llvm::ArrayRef<unsigned char> getDeviceLibrariesIdentifier();
5353

5454
llvm::ArrayRef<std::tuple<llvm::StringRef, llvm::StringRef>>
5555
getDeviceLibraries();

0 commit comments

Comments
 (0)