- Add assertions to enforce that objects are of the correct kind and
  have been allocated.

- Make destructors check if objects have been allocated before
  deleting.

- Operations that require a non-NullDevice return failure if given a
  NullDevice.

- Use static_cast rather than reinterpret_cast when cohersing from a
  base class to a derived class.

Change-Id: I02ee0ea9d7982fd7ca29d49c9b02cfae111b7127
Цей коміт міститься в:
Tony Tye
2021-01-10 02:09:00 +00:00
джерело 001fd66cac
коміт e5431676d4
11 змінених файлів з 96 додано та 13 видалено
+8 -2
Переглянути файл
@@ -52,12 +52,18 @@ class Program : public device::Program {
const NullDevice& rocNullDevice() const { return static_cast<const NullDevice&>(device()); }
//! Return a typecasted GPU device
const Device& rocDevice() const { return static_cast<const Device&>(device()); }
const Device& rocDevice() const {
assert(!isNull());
return static_cast<const Device&>(device());
}
//! Returns the hsaBinary associated with the program
hsa_agent_t hsaDevice() const { return rocNullDevice().getBackendDevice(); }
hsa_executable_t hsaExecutable() const { return hsaExecutable_; }
hsa_executable_t hsaExecutable() const {
assert(!isNull());
return hsaExecutable_;
}
virtual bool createGlobalVarObj(amd::Memory** amd_mem_obj, void** dptr,
size_t* bytes, const char* globalName) const;