SWDEV-470698 - fix formatting, add format check workflow (#657)
This commit is contained in:
1 vanhempi
5840940caa
commit
f7338717ae
1574 files changed
+162903
-199277
No files matched your search
@@ -74,7 +74,7 @@ hipError_t hipDeviceSetMemPool(int device, hipMemPool_t mem_pool) {
|
||||
// ================================================================================================
|
||||
hipError_t hipDeviceGetMemPool(hipMemPool_t* mem_pool, int device) {
|
||||
HIP_INIT_API(hipDeviceGetMemPool, mem_pool, device);
|
||||
if ((mem_pool == nullptr) || (device >= g_devices.size())) {
|
||||
if ((mem_pool == nullptr) || (device >= g_devices.size())) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
*mem_pool = reinterpret_cast<hipMemPool_t>(g_devices[device]->GetCurrentMemoryPool());
|
||||
@@ -93,8 +93,8 @@ hipError_t hipMallocAsync(void** dev_ptr, size_t size, hipStream_t stream) {
|
||||
HIP_RETURN(hipSuccess);
|
||||
}
|
||||
hip::Stream* s = reinterpret_cast<hip::Stream*>(stream);
|
||||
auto hip_stream = (stream == nullptr || stream == hipStreamLegacy) ?
|
||||
hip::getCurrentDevice()->NullStream() : s;
|
||||
auto hip_stream =
|
||||
(stream == nullptr || stream == hipStreamLegacy) ? hip::getCurrentDevice()->NullStream() : s;
|
||||
auto device = hip_stream->GetDevice();
|
||||
auto mem_pool = device->GetCurrentMemoryPool();
|
||||
|
||||
@@ -120,8 +120,8 @@ hipError_t hipMallocAsync(void** dev_ptr, size_t size, hipStream_t stream) {
|
||||
// memory allocatiom in graph, which occurs in a worker thread, and host execution of hipFreeAsync
|
||||
class FreeAsyncCommand : public amd::Command {
|
||||
private:
|
||||
void* ptr_; //!< Virtual address for asynchronious free
|
||||
hip::Event* event_; //!< HIP event, associated with this memory release
|
||||
void* ptr_; //!< Virtual address for asynchronious free
|
||||
hip::Event* event_; //!< HIP event, associated with this memory release
|
||||
|
||||
public:
|
||||
FreeAsyncCommand(amd::HostQueue& queue, void* ptr, hip::Event* event)
|
||||
@@ -150,8 +150,8 @@ hipError_t hipFreeAsync(void* dev_ptr, hipStream_t stream) {
|
||||
getStreamPerThread(stream);
|
||||
|
||||
hip::Stream* s = reinterpret_cast<hip::Stream*>(stream);
|
||||
auto hip_stream = (stream == nullptr || stream == hipStreamLegacy) ?
|
||||
hip::getCurrentDevice()->NullStream(): s;
|
||||
auto hip_stream =
|
||||
(stream == nullptr || stream == hipStreamLegacy) ? hip::getCurrentDevice()->NullStream() : s;
|
||||
|
||||
auto device = hip_stream->GetDevice();
|
||||
// Return error if any stream other than the current stream is in capture mode
|
||||
@@ -199,8 +199,7 @@ hipError_t hipFreeAsync(void* dev_ptr, hipStream_t stream) {
|
||||
// may block the execution
|
||||
event = new hip::Event(0);
|
||||
if (event != nullptr) {
|
||||
if (hipSuccess !=
|
||||
event->addMarker(hip_stream, nullptr)) {
|
||||
if (hipSuccess != event->addMarker(hip_stream, nullptr)) {
|
||||
delete event;
|
||||
event = nullptr;
|
||||
} else {
|
||||
@@ -253,10 +252,8 @@ hipError_t hipMemPoolGetAttribute(hipMemPool_t mem_pool, hipMemPoolAttr attr, vo
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
hipError_t hipMemPoolSetAccess(
|
||||
hipMemPool_t mem_pool,
|
||||
const hipMemAccessDesc* desc_list,
|
||||
size_t count) {
|
||||
hipError_t hipMemPoolSetAccess(hipMemPool_t mem_pool, const hipMemAccessDesc* desc_list,
|
||||
size_t count) {
|
||||
HIP_INIT_API(hipMemPoolSetAccess, mem_pool, desc_list, count);
|
||||
if ((mem_pool == nullptr) || (desc_list == nullptr)) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
@@ -286,10 +283,8 @@ hipError_t hipMemPoolSetAccess(
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
hipError_t hipMemPoolGetAccess(
|
||||
hipMemAccessFlags* flags,
|
||||
hipMemPool_t mem_pool,
|
||||
hipMemLocation* location) {
|
||||
hipError_t hipMemPoolGetAccess(hipMemAccessFlags* flags, hipMemPool_t mem_pool,
|
||||
hipMemLocation* location) {
|
||||
HIP_INIT_API(hipMemPoolGetAccess, flags, mem_pool, location);
|
||||
if ((mem_pool == nullptr) || (location == nullptr) || (flags == nullptr)) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
@@ -370,11 +365,8 @@ hipError_t hipMemPoolDestroy(hipMemPool_t mem_pool) {
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
hipError_t hipMallocFromPoolAsync(
|
||||
void** dev_ptr,
|
||||
size_t size,
|
||||
hipMemPool_t mem_pool,
|
||||
hipStream_t stream) {
|
||||
hipError_t hipMallocFromPoolAsync(void** dev_ptr, size_t size, hipMemPool_t mem_pool,
|
||||
hipStream_t stream) {
|
||||
HIP_INIT_API(hipMallocFromPoolAsync, dev_ptr, size, mem_pool, stream);
|
||||
if ((dev_ptr == nullptr) || (mem_pool == nullptr)) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
@@ -387,8 +379,9 @@ hipError_t hipMallocFromPoolAsync(
|
||||
STREAM_CAPTURE(hipMallocAsync, stream, mem_pool, size, dev_ptr);
|
||||
|
||||
auto mpool = reinterpret_cast<hip::MemoryPool*>(mem_pool);
|
||||
auto hip_stream = (stream == nullptr || stream == hipStreamLegacy) ?
|
||||
hip::getCurrentDevice()->NullStream() : reinterpret_cast<hip::Stream*>(stream);
|
||||
auto hip_stream = (stream == nullptr || stream == hipStreamLegacy)
|
||||
? hip::getCurrentDevice()->NullStream()
|
||||
: reinterpret_cast<hip::Stream*>(stream);
|
||||
*dev_ptr = mpool->AllocateMemory(size, hip_stream);
|
||||
if (*dev_ptr == nullptr) {
|
||||
HIP_RETURN(hipErrorOutOfMemory);
|
||||
@@ -397,11 +390,9 @@ hipError_t hipMallocFromPoolAsync(
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
hipError_t hipMemPoolExportToShareableHandle(
|
||||
void* shared_handle,
|
||||
hipMemPool_t mem_pool,
|
||||
hipMemAllocationHandleType handle_type,
|
||||
unsigned int flags) {
|
||||
hipError_t hipMemPoolExportToShareableHandle(void* shared_handle, hipMemPool_t mem_pool,
|
||||
hipMemAllocationHandleType handle_type,
|
||||
unsigned int flags) {
|
||||
HIP_INIT_API(hipMemPoolExportToShareableHandle, shared_handle, mem_pool, handle_type, flags);
|
||||
if (mem_pool == nullptr || shared_handle == nullptr || flags != 0) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
@@ -421,11 +412,9 @@ hipError_t hipMemPoolExportToShareableHandle(
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
hipError_t hipMemPoolImportFromShareableHandle(
|
||||
hipMemPool_t* mem_pool,
|
||||
void* shared_handle,
|
||||
hipMemAllocationHandleType handle_type,
|
||||
unsigned int flags) {
|
||||
hipError_t hipMemPoolImportFromShareableHandle(hipMemPool_t* mem_pool, void* shared_handle,
|
||||
hipMemAllocationHandleType handle_type,
|
||||
unsigned int flags) {
|
||||
HIP_INIT_API(hipMemPoolImportFromShareableHandle, mem_pool, shared_handle, handle_type, flags);
|
||||
if (mem_pool == nullptr || shared_handle == nullptr || flags != 0) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
@@ -470,8 +459,8 @@ hipError_t hipMemPoolExportPointer(hipMemPoolPtrExportData* export_data, void* p
|
||||
// Note: export_data must point to 64 bytes of shared memory
|
||||
auto shared = reinterpret_cast<hip::SharedMemPointer*>(export_data);
|
||||
|
||||
if (!g_devices[id]->devices()[0]->IpcCreate(ptr,
|
||||
&shared->size_, &shared->handle_[0], &shared->offset_)) {
|
||||
if (!g_devices[id]->devices()[0]->IpcCreate(ptr, &shared->size_, &shared->handle_[0],
|
||||
&shared->offset_)) {
|
||||
HIP_RETURN(hipErrorOutOfMemory);
|
||||
}
|
||||
} else {
|
||||
@@ -481,18 +470,16 @@ hipError_t hipMemPoolExportPointer(hipMemPoolPtrExportData* export_data, void* p
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
hipError_t hipMemPoolImportPointer(
|
||||
void** ptr,
|
||||
hipMemPool_t mem_pool,
|
||||
hipMemPoolPtrExportData* export_data) {
|
||||
hipError_t hipMemPoolImportPointer(void** ptr, hipMemPool_t mem_pool,
|
||||
hipMemPoolPtrExportData* export_data) {
|
||||
HIP_INIT_API(hipMemPoolImportPointer, ptr, mem_pool, export_data);
|
||||
if (mem_pool == nullptr || export_data == nullptr || ptr == nullptr) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
auto mpool = reinterpret_cast<hip::MemoryPool*>(mem_pool);
|
||||
auto shared = reinterpret_cast<hip::SharedMemPointer*>(export_data);
|
||||
if (!mpool->Device()->devices()[0]->IpcAttach(
|
||||
&shared->handle_[0], shared->size_, shared->offset_, 0, ptr)) {
|
||||
if (!mpool->Device()->devices()[0]->IpcAttach(&shared->handle_[0], shared->size_, shared->offset_,
|
||||
0, ptr)) {
|
||||
HIP_RETURN(hipErrorOutOfMemory);
|
||||
}
|
||||
size_t offset = 0;
|
||||
|
||||
Reference in new issue
Block a user