Add stronger checking
- 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
Цей коміт міститься в:
@@ -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;
|
||||
|
||||
Посилання в новій задачі
Заблокувати користувача