SWDEV-301667 - Improve logging

Change-Id: I3fa06791b7ac73d84b8a9586e6b3435fa8858d25
This commit is contained in:
Saleel Kudchadker
2024-09-18 05:39:41 +00:00
parent 12a39fbf22
commit 8c84a20b01
4 changed files with 25 additions and 21 deletions
+3
View File
@@ -132,6 +132,9 @@ int getDeviceID(amd::Context& ctx) {
// ================================================================================================
hip::Stream* getNullStream(bool wait ) {
Device* device = getCurrentDevice();
if (device == nullptr) {
LogError("Invalid device");
}
return device ? device->NullStream(wait) : nullptr;
}
+1
View File
@@ -39,6 +39,7 @@ hip::Stream* Device::NullStream(bool wait) {
}
}
if (null_stream_ == nullptr) {
LogError("Cannot create new Stream object");
return nullptr;
}
if (wait == true) {
+1 -1
View File
@@ -657,7 +657,7 @@ hipError_t hipGetDevice(int* deviceId) {
HIP_RETURN(hipErrorNoDevice);
}
*deviceId = dev;
HIP_RETURN(hipSuccess);
HIP_RETURN(hipSuccess, *deviceId);
} else {
HIP_RETURN(hipErrorInvalidValue);
}
+20 -20
View File
@@ -1360,7 +1360,24 @@ hipError_t hipHostAlloc(void** ptr, size_t sizeBytes, unsigned int flags) {
hipError_t status = ihipHostMalloc(ptr, sizeBytes, flags);
HIP_RETURN_DURATION(status, *ptr);
};
}
hipError_t hipMemcpyAsync_common(void* dst, const void* src, size_t sizeBytes,
hipMemcpyKind kind, hipStream_t stream) {
STREAM_CAPTURE(hipMemcpyAsync, stream, dst, src, sizeBytes, kind);
if (static_cast<uint32_t>(kind) > hipMemcpyDefault && kind != hipMemcpyDeviceToDeviceNoCU) {
return hipErrorInvalidMemcpyDirection;
}
hip::Stream* hip_stream = hip::getStream(stream);
if (hip_stream == nullptr) {
return hipErrorInvalidValue;
}
if (!hip::isValid(stream)) {
return hipErrorContextIsDestroyed;
}
return ihipMemcpy(dst, src, sizeBytes, kind, *hip_stream, true);
}
inline hipError_t ihipMemcpySymbol_validate(const void* symbol, size_t sizeBytes,
size_t offset, size_t &sym_size, hipDeviceptr_t &device_ptr) {
@@ -1462,8 +1479,8 @@ hipError_t hipMemcpyToSymbolAsync_common(const void* symbol, const void* src, si
if (status != hipSuccess) {
return status;
}
/* Copy memory from source to destination address */
return hipMemcpyAsync(device_ptr, src, sizeBytes, kind, stream);
return hipMemcpyAsync_common(device_ptr, src, sizeBytes, kind, stream);
}
hipError_t hipMemcpyToSymbolAsync(const void* symbol, const void* src, size_t sizeBytes,
@@ -1549,23 +1566,6 @@ hipError_t hipMemcpyDtoD(hipDeviceptr_t dstDevice,
HIP_RETURN_DURATION(ihipMemcpy(dstDevice, srcDevice, ByteCount, hipMemcpyDeviceToDevice, *stream));
}
hipError_t hipMemcpyAsync_common(void* dst, const void* src, size_t sizeBytes,
hipMemcpyKind kind, hipStream_t stream) {
STREAM_CAPTURE(hipMemcpyAsync, stream, dst, src, sizeBytes, kind);
if (static_cast<uint32_t>(kind) > hipMemcpyDefault && kind != hipMemcpyDeviceToDeviceNoCU) {
return hipErrorInvalidMemcpyDirection;
}
hip::Stream* hip_stream = hip::getStream(stream);
if (hip_stream == nullptr) {
return hipErrorInvalidValue;
}
if (!hip::isValid(stream)) {
return hipErrorContextIsDestroyed;
}
return ihipMemcpy(dst, src, sizeBytes, kind, *hip_stream, true);
}
hipError_t hipMemcpyAsync(void* dst, const void* src, size_t sizeBytes,
hipMemcpyKind kind, hipStream_t stream) {
HIP_INIT_API(hipMemcpyAsync, dst, src, sizeBytes, kind, stream);