SWDEV-465085 - replace asserts inside API calls
This change replaces some asserts, that were only available in debug mode, with standard error handling. Signed-off-by: Sebastian Luzynski <Sebastian.Luzynski@amd.com> Change-Id: I112f9e56f921abd72daf0d11e4ecdcb7b1a9f9e6
Этот коммит содержится в:
@@ -1163,13 +1163,16 @@ hipError_t StatCO::digestFatBinary(const void* data, FatBinaryInfo*& programs) {
|
||||
return hipSuccess;
|
||||
}
|
||||
|
||||
FatBinaryInfo** StatCO::addFatBinary(const void* data, bool initialized) {
|
||||
FatBinaryInfo** StatCO::addFatBinary(const void* data, bool initialized, bool& success) {
|
||||
amd::ScopedLock lock(sclock_);
|
||||
|
||||
if (initialized) {
|
||||
hipError_t err = digestFatBinary(data, modules_[data]);
|
||||
assert(err == hipSuccess);
|
||||
if (initialized == false) {
|
||||
success = true;
|
||||
return &modules_[data];
|
||||
}
|
||||
|
||||
hipError_t err = digestFatBinary(data, modules_[data]);
|
||||
success = (err == hipSuccess);
|
||||
return &modules_[data];
|
||||
}
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ public:
|
||||
virtual ~StatCO();
|
||||
|
||||
//Add/Remove/Digest Fat Binaries passed to us from "__hipRegisterFatBinary"
|
||||
FatBinaryInfo** addFatBinary(const void* data, bool initialized);
|
||||
FatBinaryInfo** addFatBinary(const void* data, bool initialized, bool& success);
|
||||
hipError_t removeFatBinary(FatBinaryInfo** module);
|
||||
hipError_t digestFatBinary(const void* data, FatBinaryInfo*& programs);
|
||||
|
||||
|
||||
@@ -194,7 +194,9 @@ hipError_t hipGraphicsSubResourceGetMappedArray(hipArray_t* array, hipGraphicsRe
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
// arrayIndex higher than zero not implmented
|
||||
assert(arrayIndex == 0) ;
|
||||
if (arrayIndex > 0) {
|
||||
return hipErrorInvalidValue;
|
||||
}
|
||||
amd::Image * view = image->createView(amdContext, image->getImageFormat(), nullptr, mipLevel, 0);
|
||||
|
||||
hipArray* myarray = new hipArray();
|
||||
@@ -770,4 +772,4 @@ hipError_t hipGraphicsUnregisterResource(hipGraphicsResource_t resource) {
|
||||
|
||||
HIP_RETURN(hipSuccess);
|
||||
}
|
||||
} // namespace hip
|
||||
} // namespace hip
|
||||
|
||||
@@ -2191,9 +2191,10 @@ hipError_t ihipMemcpyAtoAValidate(hipArray_t srcArray, hipArray_t dstArray, amd:
|
||||
|
||||
// HIP assumes the width is in bytes, but OCL assumes it's in pixels.
|
||||
// Note that src and dst should have the same element size.
|
||||
assert(srcImage->getImageFormat().getElementSize() ==
|
||||
dstImage->getImageFormat().getElementSize());
|
||||
const size_t elementSize = srcImage->getImageFormat().getElementSize();
|
||||
if (elementSize != dstImage->getImageFormat().getElementSize()) {
|
||||
return hipErrorInvalidValue;
|
||||
}
|
||||
static_cast<size_t*>(srcOrigin)[0] /= elementSize;
|
||||
static_cast<size_t*>(dstOrigin)[0] /= elementSize;
|
||||
static_cast<size_t*>(copyRegion)[0] /= elementSize;
|
||||
|
||||
@@ -76,7 +76,10 @@ void** __hipRegisterFatBinary(const void* data) {
|
||||
fbwrapper->version);
|
||||
return nullptr;
|
||||
}
|
||||
return reinterpret_cast<void**>(PlatformState::instance().addFatBinary(fbwrapper->binary));
|
||||
|
||||
bool success{};
|
||||
auto fat_binary_info = PlatformState::instance().addFatBinary(fbwrapper->binary, success);
|
||||
return success ? reinterpret_cast<void**>(fat_binary_info) : nullptr;
|
||||
}
|
||||
|
||||
void __hipRegisterFunction(hip::FatBinaryInfo** modules, const void* hostFunction,
|
||||
@@ -899,8 +902,8 @@ hipError_t PlatformState::digestFatBinary(const void* data, hip::FatBinaryInfo*&
|
||||
return statCO_.digestFatBinary(data, programs);
|
||||
}
|
||||
|
||||
hip::FatBinaryInfo** PlatformState::addFatBinary(const void* data) {
|
||||
return statCO_.addFatBinary(data, initialized_);
|
||||
hip::FatBinaryInfo** PlatformState::addFatBinary(const void* data, bool& success) {
|
||||
return statCO_.addFatBinary(data, initialized_, success);
|
||||
}
|
||||
|
||||
hipError_t PlatformState::removeFatBinary(hip::FatBinaryInfo** module) {
|
||||
|
||||
@@ -82,7 +82,7 @@ class PlatformState {
|
||||
}
|
||||
|
||||
// Static Code Objects functions
|
||||
hip::FatBinaryInfo** addFatBinary(const void* data);
|
||||
hip::FatBinaryInfo** addFatBinary(const void* data, bool& success);
|
||||
hipError_t removeFatBinary(hip::FatBinaryInfo** module);
|
||||
hipError_t digestFatBinary(const void* data, hip::FatBinaryInfo*& programs);
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user