From 204ecba4b686b7491f060d2444beef18c6c84478 Mon Sep 17 00:00:00 2001 From: foreman Date: Thu, 5 Apr 2018 15:02:43 -0400 Subject: [PATCH] P4 to Git Change 1537228 by skudchad@skudchad_test2_win_opencl on 2018/04/05 14:53:31 SWDEV-145570 - [HIP] - Add HIP Memory, texture, surface, context api skeletons ReviewBoardURL = http://ocltc.amd.com/reviews/r/14565/diff/ Affected files ... ... //depot/stg/opencl/drivers/opencl/api/hip/hip_context.cpp#6 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_device.cpp#9 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_event.cpp#2 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_memory.cpp#7 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_stream.cpp#3 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_surface.cpp#1 add ... //depot/stg/opencl/drivers/opencl/api/hip/hip_texture.cpp#1 add --- api/hip/hip_context.cpp | 126 ++++++++++++++++++++----- api/hip/hip_device.cpp | 3 +- api/hip/hip_event.cpp | 36 ++++--- api/hip/hip_memory.cpp | 172 +++++++++++++++++----------------- api/hip/hip_stream.cpp | 44 ++++++--- api/hip/hip_surface.cpp | 49 ++++++++++ api/hip/hip_texture.cpp | 202 ++++++++++++++++++++++++++++++++++++++++ 7 files changed, 496 insertions(+), 136 deletions(-) create mode 100644 api/hip/hip_surface.cpp create mode 100644 api/hip/hip_texture.cpp diff --git a/api/hip/hip_context.cpp b/api/hip/hip_context.cpp index 9603b938b6..9bfe4ad45d 100644 --- a/api/hip/hip_context.cpp +++ b/api/hip/hip_context.cpp @@ -33,8 +33,7 @@ thread_local std::stack g_ctxtStack; std::vector g_devices; std::once_flag g_ihipInitialized; -void ihipInit() -{ +void ihipInit() { if (!amd::Runtime::initialized()) { amd::Runtime::init(); } @@ -55,17 +54,13 @@ void ihipInit() } } - -hipError_t hipInit(unsigned int flags) -{ +hipError_t hipInit(unsigned int flags) { HIP_INIT_API(flags); return hipSuccess; } - -hipError_t hipCtxCreate(hipCtx_t *ctx, unsigned int flags, hipDevice_t device) -{ +hipError_t hipCtxCreate(hipCtx_t *ctx, unsigned int flags, hipDevice_t device) { HIP_INIT_API(ctx, flags, device); if (static_cast(device) >= g_devices.size()) { @@ -80,8 +75,7 @@ hipError_t hipCtxCreate(hipCtx_t *ctx, unsigned int flags, hipDevice_t device) return hipSuccess; } -hipError_t hipCtxSetCurrent(hipCtx_t ctx) -{ +hipError_t hipCtxSetCurrent(hipCtx_t ctx) { HIP_INIT_API(ctx); if (ctx == nullptr) { @@ -99,8 +93,7 @@ hipError_t hipCtxSetCurrent(hipCtx_t ctx) return hipSuccess; } -hipError_t hipCtxGetCurrent(hipCtx_t* ctx) -{ +hipError_t hipCtxGetCurrent(hipCtx_t* ctx) { HIP_INIT_API(ctx); *ctx = reinterpret_cast(g_context); @@ -108,8 +101,7 @@ hipError_t hipCtxGetCurrent(hipCtx_t* ctx) return hipSuccess; } -hipError_t hipRuntimeGetVersion(int *runtimeVersion) -{ +hipError_t hipRuntimeGetVersion(int *runtimeVersion) { HIP_INIT_API(runtimeVersion); if (!runtimeVersion) { @@ -121,8 +113,7 @@ hipError_t hipRuntimeGetVersion(int *runtimeVersion) return hipSuccess; } -hipError_t hipCtxDestroy(hipCtx_t ctx) -{ +hipError_t hipCtxDestroy(hipCtx_t ctx) { HIP_INIT_API(ctx); amd::Context* amdContext = reinterpret_cast(as_amd(ctx)); @@ -146,9 +137,7 @@ hipError_t hipCtxDestroy(hipCtx_t ctx) return hipSuccess; } - -hipError_t hipCtxPopCurrent(hipCtx_t* ctx) -{ +hipError_t hipCtxPopCurrent(hipCtx_t* ctx) { HIP_INIT_API(ctx); amd::Context* amdContext = reinterpret_cast(as_amd(ctx)); @@ -166,8 +155,7 @@ hipError_t hipCtxPopCurrent(hipCtx_t* ctx) return hipSuccess; } -hipError_t hipCtxPushCurrent(hipCtx_t ctx) -{ +hipError_t hipCtxPushCurrent(hipCtx_t ctx) { HIP_INIT_API(ctx); amd::Context* amdContext = reinterpret_cast(as_amd(ctx)); @@ -180,3 +168,99 @@ hipError_t hipCtxPushCurrent(hipCtx_t ctx) return hipSuccess; } + +hipError_t hipCtxGetDevice(hipDevice_t* device) { + HIP_INIT_API(device); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipCtxGetApiVersion(hipCtx_t ctx, int* apiVersion) { + HIP_INIT_API(apiVersion); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipCtxGetCacheConfig(hipFuncCache_t* cacheConfig) { + HIP_INIT_API(cacheConfig); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipCtxSetCacheConfig(hipFuncCache_t cacheConfig) { + HIP_INIT_API(cacheConfig); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipCtxSetSharedMemConfig(hipSharedMemConfig config) { + HIP_INIT_API(config); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipCtxSynchronize(void) { + HIP_INIT_API(1); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipCtxGetFlags(unsigned int* flags) { + HIP_INIT_API(flags); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipDevicePrimaryCtxGetState(hipDevice_t dev, unsigned int* flags, int* active) { + HIP_INIT_API(dev, flags, active); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipDevicePrimaryCtxRelease(hipDevice_t dev) { + HIP_INIT_API(dev); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipDevicePrimaryCtxRetain(hipCtx_t* pctx, hipDevice_t dev) { + HIP_INIT_API(pctx, dev); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipDevicePrimaryCtxReset(hipDevice_t dev) { + HIP_INIT_API(dev); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipDevicePrimaryCtxSetFlags(hipDevice_t dev, unsigned int flags) { + HIP_INIT_API(dev, flags); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} \ No newline at end of file diff --git a/api/hip/hip_device.cpp b/api/hip/hip_device.cpp index efb77fb7b0..d067cf19a8 100644 --- a/api/hip/hip_device.cpp +++ b/api/hip/hip_device.cpp @@ -24,8 +24,7 @@ THE SOFTWARE. #include "hip_internal.hpp" -hipError_t hipDeviceGet(hipDevice_t *device, int deviceId) -{ +hipError_t hipDeviceGet(hipDevice_t *device, int deviceId) { HIP_INIT_API(device, deviceId); if (device != nullptr) { diff --git a/api/hip/hip_event.cpp b/api/hip/hip_event.cpp index 117b28355e..1fe7be9e2f 100644 --- a/api/hip/hip_event.cpp +++ b/api/hip/hip_event.cpp @@ -24,44 +24,56 @@ THE SOFTWARE. #include "hip_internal.hpp" -hipError_t hipEventCreateWithFlags(hipEvent_t* event, unsigned flags) -{ +hipError_t hipEventCreateWithFlags(hipEvent_t* event, unsigned flags) { HIP_INIT_API(event, flags); + assert(0 && "Unimplemented"); + return hipErrorUnknown; } -hipError_t hipEventCreate(hipEvent_t* event) -{ +hipError_t hipEventCreate(hipEvent_t* event) { HIP_INIT_API(event); + assert(0 && "Unimplemented"); + return hipErrorUnknown; } -hipError_t hipEventDestroy(hipEvent_t event) -{ +hipError_t hipEventDestroy(hipEvent_t event) { HIP_INIT_API(event); + assert(0 && "Unimplemented"); + return hipErrorUnknown; } -hipError_t hipEventElapsedTime(float *ms, hipEvent_t start, hipEvent_t stop) -{ +hipError_t hipEventElapsedTime(float *ms, hipEvent_t start, hipEvent_t stop) { HIP_INIT_API(ms, start, stop); return hipErrorUnknown; } -hipError_t hipEventRecord(hipEvent_t event, hipStream_t stream) -{ +hipError_t hipEventRecord(hipEvent_t event, hipStream_t stream) { HIP_INIT_API(event, stream); + assert(0 && "Unimplemented"); + return hipErrorUnknown; } -hipError_t hipEventSynchronize(hipEvent_t event) -{ +hipError_t hipEventSynchronize(hipEvent_t event) { HIP_INIT_API(event); + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipEventQuery(hipEvent_t event) { + HIP_INIT_API(event); + + assert(0 && "Unimplemented"); + return hipErrorUnknown; } diff --git a/api/hip/hip_memory.cpp b/api/hip/hip_memory.cpp index 1fc000bf1d..f2dfcf4b4a 100644 --- a/api/hip/hip_memory.cpp +++ b/api/hip/hip_memory.cpp @@ -24,8 +24,7 @@ THE SOFTWARE. #include "hip_internal.hpp" -hipError_t hipMalloc(void** ptr, size_t sizeBytes) -{ +hipError_t hipMalloc(void** ptr, size_t sizeBytes) { HIP_INIT_API(ptr, sizeBytes); if (sizeBytes == 0) { @@ -54,8 +53,7 @@ hipError_t hipMalloc(void** ptr, size_t sizeBytes) return hipSuccess; } -hipError_t hipHostMalloc(void** ptr, size_t sizeBytes, unsigned int flags) -{ +hipError_t hipHostMalloc(void** ptr, size_t sizeBytes, unsigned int flags) { HIP_INIT_API(ptr, sizeBytes, flags); if (sizeBytes == 0) { @@ -78,8 +76,7 @@ hipError_t hipHostMalloc(void** ptr, size_t sizeBytes, unsigned int flags) return hipSuccess; } -hipError_t hipFree(void* ptr) -{ +hipError_t hipFree(void* ptr) { if (amd::SvmBuffer::malloced(ptr)) { amd::SvmBuffer::free(*g_context, ptr); return hipSuccess; @@ -91,8 +88,7 @@ hipError_t hipFree(void* ptr) return hipSuccess; } -hipError_t hipMemcpy(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind kind) -{ +hipError_t hipMemcpy(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind kind) { HIP_INIT_API(dst, src, sizeBytes, kind); amd::Device* device = g_context->devices()[0]; @@ -142,8 +138,7 @@ hipError_t hipMemcpy(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind return hipSuccess; } -hipError_t hipMemsetAsync(void* dst, int value, size_t sizeBytes, hipStream_t stream ) -{ +hipError_t hipMemsetAsync(void* dst, int value, size_t sizeBytes, hipStream_t stream) { HIP_INIT_API(dst, value, sizeBytes, stream); assert(0 && "Unimplemented"); @@ -151,8 +146,7 @@ hipError_t hipMemsetAsync(void* dst, int value, size_t sizeBytes, hipStream_t s return hipErrorUnknown; } -hipError_t hipMemset(void* dst, int value, size_t sizeBytes) -{ +hipError_t hipMemset(void* dst, int value, size_t sizeBytes) { HIP_INIT_API(dst, value, sizeBytes); assert(0 && "Unimplemented"); @@ -160,8 +154,7 @@ hipError_t hipMemset(void* dst, int value, size_t sizeBytes) return hipErrorUnknown; } -hipError_t hipMemPtrGetInfo(void *ptr, size_t *size) -{ +hipError_t hipMemPtrGetInfo(void *ptr, size_t *size) { HIP_INIT_API(ptr, size); assert(0 && "Unimplemented"); @@ -169,8 +162,7 @@ hipError_t hipMemPtrGetInfo(void *ptr, size_t *size) return hipErrorUnknown; } -hipError_t hipHostFree(void* ptr) -{ +hipError_t hipHostFree(void* ptr) { HIP_INIT_API(ptr); assert(0 && "Unimplemented"); @@ -178,8 +170,7 @@ hipError_t hipHostFree(void* ptr) return hipErrorUnknown; } -hipError_t hipFreeArray(hipArray* array) -{ +hipError_t hipFreeArray(hipArray* array) { HIP_INIT_API(array); assert(0 && "Unimplemented"); @@ -187,8 +178,7 @@ hipError_t hipFreeArray(hipArray* array) return hipErrorUnknown; } -hipError_t hipMemGetAddressRange(hipDeviceptr_t* pbase, size_t* psize, hipDeviceptr_t dptr) -{ +hipError_t hipMemGetAddressRange(hipDeviceptr_t* pbase, size_t* psize, hipDeviceptr_t dptr) { HIP_INIT_API(pbase, psize, dptr); assert(0 && "Unimplemented"); @@ -196,8 +186,7 @@ hipError_t hipMemGetAddressRange(hipDeviceptr_t* pbase, size_t* psize, hipDevice return hipErrorUnknown; } -hipError_t hipMemGetInfo(size_t* free, size_t* total) -{ +hipError_t hipMemGetInfo(size_t* free, size_t* total) { HIP_INIT_API(free, total); assert(0 && "Unimplemented"); @@ -205,8 +194,7 @@ hipError_t hipMemGetInfo(size_t* free, size_t* total) return hipErrorUnknown; } -hipError_t hipMallocPitch(void** ptr, size_t* pitch, size_t width, size_t height) -{ +hipError_t hipMallocPitch(void** ptr, size_t* pitch, size_t width, size_t height) { HIP_INIT_API(ptr, pitch, width, height); assert(0 && "Unimplemented"); @@ -214,8 +202,7 @@ hipError_t hipMallocPitch(void** ptr, size_t* pitch, size_t width, size_t height return hipErrorUnknown; } -hipError_t hipMalloc3D(hipPitchedPtr* pitchedDevPtr, hipExtent extent) -{ +hipError_t hipMalloc3D(hipPitchedPtr* pitchedDevPtr, hipExtent extent) { HIP_INIT_API(pitchedDevPtr, &extent); assert(0 && "Unimplemented"); @@ -223,8 +210,7 @@ hipError_t hipMalloc3D(hipPitchedPtr* pitchedDevPtr, hipExtent extent) return hipErrorUnknown; } -hipError_t hipArrayCreate(hipArray** array, const HIP_ARRAY_DESCRIPTOR* pAllocateArray) -{ +hipError_t hipArrayCreate(hipArray** array, const HIP_ARRAY_DESCRIPTOR* pAllocateArray) { HIP_INIT_API(array, pAllocateArray); assert(0 && "Unimplemented"); @@ -233,8 +219,7 @@ hipError_t hipArrayCreate(hipArray** array, const HIP_ARRAY_DESCRIPTOR* pAllocat } hipError_t hipMallocArray(hipArray** array, const hipChannelFormatDesc* desc, - size_t width, size_t height, unsigned int flags) -{ + size_t width, size_t height, unsigned int flags) { HIP_INIT_API(array, desc, width, height, flags); assert(0 && "Unimplemented"); @@ -243,8 +228,7 @@ hipError_t hipMallocArray(hipArray** array, const hipChannelFormatDesc* desc, } hipError_t hipMalloc3DArray(hipArray_t* array, const struct hipChannelFormatDesc* desc, - struct hipExtent extent, unsigned int flags) -{ + struct hipExtent extent, unsigned int flags) { HIP_INIT_API(array, desc, &extent, flags); assert(0 && "Unimplemented"); @@ -252,8 +236,7 @@ hipError_t hipMalloc3DArray(hipArray_t* array, const struct hipChannelFormatDesc return hipErrorUnknown; } -hipError_t hipHostGetFlags(unsigned int* flagsPtr, void* hostPtr) -{ +hipError_t hipHostGetFlags(unsigned int* flagsPtr, void* hostPtr) { HIP_INIT_API(flagsPtr, hostPtr); assert(0 && "Unimplemented"); @@ -261,8 +244,7 @@ hipError_t hipHostGetFlags(unsigned int* flagsPtr, void* hostPtr) return hipErrorUnknown; } -hipError_t hipHostRegister(void* hostPtr, size_t sizeBytes, unsigned int flags) -{ +hipError_t hipHostRegister(void* hostPtr, size_t sizeBytes, unsigned int flags) { HIP_INIT_API(hostPtr, sizeBytes, flags); assert(0 && "Unimplemented"); @@ -270,8 +252,7 @@ hipError_t hipHostRegister(void* hostPtr, size_t sizeBytes, unsigned int flags) return hipErrorUnknown; } -hipError_t hipHostUnregister(void* hostPtr) -{ +hipError_t hipHostUnregister(void* hostPtr) { HIP_INIT_API(hostPtr); assert(0 && "Unimplemented"); @@ -280,8 +261,7 @@ hipError_t hipHostUnregister(void* hostPtr) } hipError_t hipMemcpyToSymbol(const void* symbolName, const void* src, size_t count, - size_t offset, hipMemcpyKind kind) -{ + size_t offset, hipMemcpyKind kind) { HIP_INIT_API(symbolName, src, count, offset, kind); assert(0 && "Unimplemented"); @@ -290,8 +270,7 @@ hipError_t hipMemcpyToSymbol(const void* symbolName, const void* src, size_t cou } hipError_t hipMemcpyFromSymbol(void* dst, const void* symbolName, size_t count, - size_t offset, hipMemcpyKind kind) -{ + size_t offset, hipMemcpyKind kind) { HIP_INIT_API(symbolName, dst, count, offset, kind); assert(0 && "Unimplemented"); @@ -300,8 +279,7 @@ hipError_t hipMemcpyFromSymbol(void* dst, const void* symbolName, size_t count, } hipError_t hipMemcpyToSymbolAsync(const void* symbolName, const void* src, size_t count, - size_t offset, hipMemcpyKind kind, hipStream_t stream) -{ + size_t offset, hipMemcpyKind kind, hipStream_t stream) { HIP_INIT_API(symbolName, src, count, offset, kind, stream); assert(0 && "Unimplemented"); @@ -310,8 +288,7 @@ hipError_t hipMemcpyToSymbolAsync(const void* symbolName, const void* src, size_ } hipError_t hipMemcpyFromSymbolAsync(void* dst, const void* symbolName, size_t count, - size_t offset, hipMemcpyKind kind, hipStream_t stream) -{ + size_t offset, hipMemcpyKind kind, hipStream_t stream) { HIP_INIT_API(symbolName, dst, count, offset, kind, stream); assert(0 && "Unimplemented"); @@ -319,8 +296,7 @@ hipError_t hipMemcpyFromSymbolAsync(void* dst, const void* symbolName, size_t co return hipErrorUnknown; } -hipError_t hipMemcpyHtoD(hipDeviceptr_t dst, void* src, size_t sizeBytes) -{ +hipError_t hipMemcpyHtoD(hipDeviceptr_t dst, void* src, size_t sizeBytes) { HIP_INIT_API(dst, src, sizeBytes); assert(0 && "Unimplemented"); @@ -328,8 +304,7 @@ hipError_t hipMemcpyHtoD(hipDeviceptr_t dst, void* src, size_t sizeBytes) return hipErrorUnknown; } -hipError_t hipMemcpyDtoH(void* dst, hipDeviceptr_t src, size_t sizeBytes) -{ +hipError_t hipMemcpyDtoH(void* dst, hipDeviceptr_t src, size_t sizeBytes) { HIP_INIT_API(dst, src, sizeBytes); assert(0 && "Unimplemented"); @@ -337,8 +312,7 @@ hipError_t hipMemcpyDtoH(void* dst, hipDeviceptr_t src, size_t sizeBytes) return hipErrorUnknown; } -hipError_t hipMemcpyDtoD(hipDeviceptr_t dst, hipDeviceptr_t src, size_t sizeBytes) -{ +hipError_t hipMemcpyDtoD(hipDeviceptr_t dst, hipDeviceptr_t src, size_t sizeBytes) { HIP_INIT_API(dst, src, sizeBytes); assert(0 && "Unimplemented"); @@ -346,8 +320,7 @@ hipError_t hipMemcpyDtoD(hipDeviceptr_t dst, hipDeviceptr_t src, size_t sizeByte return hipErrorUnknown; } -hipError_t hipMemcpyHtoH(void* dst, void* src, size_t sizeBytes) -{ +hipError_t hipMemcpyHtoH(void* dst, void* src, size_t sizeBytes) { HIP_INIT_API(dst, src, sizeBytes); assert(0 && "Unimplemented"); @@ -356,8 +329,7 @@ hipError_t hipMemcpyHtoH(void* dst, void* src, size_t sizeBytes) } hipError_t hipMemcpyAsync(void* dst, const void* src, size_t sizeBytes, - hipMemcpyKind kind, hipStream_t stream) -{ + hipMemcpyKind kind, hipStream_t stream) { HIP_INIT_API(dst, src, sizeBytes, kind, stream); assert(0 && "Unimplemented"); @@ -367,8 +339,7 @@ hipError_t hipMemcpyAsync(void* dst, const void* src, size_t sizeBytes, hipError_t hipMemcpyHtoDAsync(hipDeviceptr_t dst, void* src, size_t sizeBytes, - hipStream_t stream) -{ + hipStream_t stream) { HIP_INIT_API(dst, src, sizeBytes, stream); assert(0 && "Unimplemented"); @@ -377,8 +348,7 @@ hipError_t hipMemcpyHtoDAsync(hipDeviceptr_t dst, void* src, size_t sizeBytes, } hipError_t hipMemcpyDtoDAsync(hipDeviceptr_t dst, hipDeviceptr_t src, size_t sizeBytes, - hipStream_t stream) -{ + hipStream_t stream) { HIP_INIT_API(dst, src, sizeBytes, stream); assert(0 && "Unimplemented"); @@ -387,8 +357,7 @@ hipError_t hipMemcpyDtoDAsync(hipDeviceptr_t dst, hipDeviceptr_t src, size_t siz } hipError_t hipMemcpyDtoHAsync(void* dst, hipDeviceptr_t src, size_t sizeBytes, - hipStream_t stream) -{ + hipStream_t stream) { HIP_INIT_API(dst, src, sizeBytes, stream); assert(0 && "Unimplemented"); @@ -397,8 +366,7 @@ hipError_t hipMemcpyDtoHAsync(void* dst, hipDeviceptr_t src, size_t sizeBytes, } hipError_t hipMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, - size_t height, hipMemcpyKind kind) -{ + size_t height, hipMemcpyKind kind) { HIP_INIT_API(dst, dpitch, src, spitch, width, height, kind); assert(0 && "Unimplemented"); @@ -406,8 +374,7 @@ hipError_t hipMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, return hipErrorUnknown; } -hipError_t hipMemcpyParam2D(const hip_Memcpy2D* pCopy) -{ +hipError_t hipMemcpyParam2D(const hip_Memcpy2D* pCopy) { HIP_INIT_API(pCopy); assert(0 && "Unimplemented"); @@ -416,8 +383,7 @@ hipError_t hipMemcpyParam2D(const hip_Memcpy2D* pCopy) } hipError_t hipMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, - size_t height, hipMemcpyKind kind, hipStream_t stream) -{ + size_t height, hipMemcpyKind kind, hipStream_t stream) { HIP_INIT_API(dst, dpitch, src, spitch, width, height, kind, stream); assert(0 && "Unimplemented"); @@ -426,8 +392,7 @@ hipError_t hipMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t sp } hipError_t hipMemcpy2DToArray(hipArray* dst, size_t wOffset, size_t hOffset, const void* src, - size_t spitch, size_t width, size_t height, hipMemcpyKind kind) -{ + size_t spitch, size_t width, size_t height, hipMemcpyKind kind) { HIP_INIT_API(dst, wOffset, hOffset, src, spitch, width, height, kind); assert(0 && "Unimplemented"); @@ -436,8 +401,7 @@ hipError_t hipMemcpy2DToArray(hipArray* dst, size_t wOffset, size_t hOffset, con } hipError_t hipMemcpyToArray(hipArray* dst, size_t wOffset, size_t hOffset, const void* src, - size_t count, hipMemcpyKind kind) -{ + size_t count, hipMemcpyKind kind) { HIP_INIT_API(dst, wOffset, hOffset, src, count, kind); assert(0 && "Unimplemented"); @@ -446,8 +410,7 @@ hipError_t hipMemcpyToArray(hipArray* dst, size_t wOffset, size_t hOffset, const } hipError_t hipMemcpyFromArray(void* dst, hipArray_const_t srcArray, size_t wOffset, size_t hOffset, - size_t count, hipMemcpyKind kind) -{ + size_t count, hipMemcpyKind kind) { HIP_INIT_API(dst, srcArray, wOffset, hOffset, count, kind); assert(0 && "Unimplemented"); @@ -455,8 +418,7 @@ hipError_t hipMemcpyFromArray(void* dst, hipArray_const_t srcArray, size_t wOffs return hipErrorUnknown; } -hipError_t hipMemcpyHtoA(hipArray* dstArray, size_t dstOffset, const void* srcHost, size_t count) -{ +hipError_t hipMemcpyHtoA(hipArray* dstArray, size_t dstOffset, const void* srcHost, size_t count) { HIP_INIT_API(dstArray, dstOffset, srcHost, count); assert(0 && "Unimplemented"); @@ -464,8 +426,7 @@ hipError_t hipMemcpyHtoA(hipArray* dstArray, size_t dstOffset, const void* srcHo return hipErrorUnknown; } -hipError_t hipMemcpyAtoH(void* dst, hipArray* srcArray, size_t srcOffset, size_t count) -{ +hipError_t hipMemcpyAtoH(void* dst, hipArray* srcArray, size_t srcOffset, size_t count) { HIP_INIT_API(dst, srcArray, srcOffset, count); assert(0 && "Unimplemented"); @@ -473,8 +434,7 @@ hipError_t hipMemcpyAtoH(void* dst, hipArray* srcArray, size_t srcOffset, size_t return hipErrorUnknown; } -hipError_t hipMemcpy3D(const struct hipMemcpy3DParms* p) -{ +hipError_t hipMemcpy3D(const struct hipMemcpy3DParms* p) { HIP_INIT_API(p); assert(0 && "Unimplemented"); @@ -482,8 +442,7 @@ hipError_t hipMemcpy3D(const struct hipMemcpy3DParms* p) return hipErrorUnknown; } -hipError_t hipMemset2D(void* dst, size_t pitch, int value, size_t width, size_t height) -{ +hipError_t hipMemset2D(void* dst, size_t pitch, int value, size_t width, size_t height) { HIP_INIT_API(dst, pitch, value, width, height); assert(0 && "Unimplemented"); @@ -491,8 +450,7 @@ hipError_t hipMemset2D(void* dst, size_t pitch, int value, size_t width, size_t return hipErrorUnknown; } -hipError_t hipMemsetD8(hipDeviceptr_t dst, unsigned char value, size_t sizeBytes) -{ +hipError_t hipMemsetD8(hipDeviceptr_t dst, unsigned char value, size_t sizeBytes) { HIP_INIT_API(dst, value, sizeBytes); assert(0 && "Unimplemented"); @@ -500,8 +458,7 @@ hipError_t hipMemsetD8(hipDeviceptr_t dst, unsigned char value, size_t sizeBytes return hipErrorUnknown; } -hipError_t hipIpcGetMemHandle(hipIpcMemHandle_t* handle, void* devPtr) -{ +hipError_t hipIpcGetMemHandle(hipIpcMemHandle_t* handle, void* devPtr) { HIP_INIT_API(handle, devPtr); assert(0 && "Unimplemented"); @@ -509,8 +466,7 @@ hipError_t hipIpcGetMemHandle(hipIpcMemHandle_t* handle, void* devPtr) return hipErrorUnknown; } -hipError_t hipIpcOpenMemHandle(void** devPtr, hipIpcMemHandle_t handle, unsigned int flags) -{ +hipError_t hipIpcOpenMemHandle(void** devPtr, hipIpcMemHandle_t handle, unsigned int flags) { HIP_INIT_API(devPtr, &handle, flags); assert(0 && "Unimplemented"); @@ -524,4 +480,42 @@ hipError_t hipIpcCloseMemHandle(void* devPtr) { assert(0 && "Unimplemented"); return hipErrorUnknown; -} \ No newline at end of file +} + +hipError_t hipMemcpyPeer(void* dst, hipCtx_t dstCtx, const void* src, hipCtx_t srcCtx, + size_t sizeBytes) { + HIP_INIT_API(dst, dstCtx, src, srcCtx, sizeBytes); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + + +hipError_t hipMemcpyPeerAsync(void* dst, hipCtx_t dstDevice, const void* src, hipCtx_t srcDevice, + size_t sizeBytes, hipStream_t stream) { + HIP_INIT_API(dst, dstDevice, src, srcDevice, sizeBytes, stream); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipMemcpyPeer(void* dst, int dstDevice, const void* src, int srcDevice, + size_t sizeBytes) { + HIP_INIT_API(dst, dstDevice, src, srcDevice, sizeBytes); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipMemcpyPeerAsync(void* dst, int dstDevice, const void* src, int srcDevice, + size_t sizeBytes, hipStream_t stream) { + HIP_INIT_API(dst, dstDevice, src, srcDevice, sizeBytes, stream); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + diff --git a/api/hip/hip_stream.cpp b/api/hip/hip_stream.cpp index 46014ebfef..6d0da6adfc 100644 --- a/api/hip/hip_stream.cpp +++ b/api/hip/hip_stream.cpp @@ -24,8 +24,7 @@ THE SOFTWARE. #include "hip_internal.hpp" -static hipError_t ihipStreamCreateWithFlags(hipStream_t *stream, unsigned int flags) -{ +static hipError_t ihipStreamCreateWithFlags(hipStream_t *stream, unsigned int flags) { assert(flags == 0); // we don't handle flags yet amd::Device* device = g_context->devices()[0]; @@ -43,24 +42,21 @@ static hipError_t ihipStreamCreateWithFlags(hipStream_t *stream, unsigned int fl return hipSuccess; } -hipError_t hipStreamCreateWithFlags(hipStream_t *stream, unsigned int flags) -{ +hipError_t hipStreamCreateWithFlags(hipStream_t *stream, unsigned int flags) { HIP_INIT_API(stream, flags); return ihipStreamCreateWithFlags(stream, flags); } -hipError_t hipStreamCreate(hipStream_t *stream) -{ +hipError_t hipStreamCreate(hipStream_t *stream) { HIP_INIT_API(stream); return ihipStreamCreateWithFlags(stream, hipStreamDefault); } -hipError_t hipStreamGetFlags(hipStream_t stream, unsigned int *flags) -{ +hipError_t hipStreamGetFlags(hipStream_t stream, unsigned int *flags) { HIP_INIT_API(stream, flags); assert(0 && "Unimplemented"); @@ -69,8 +65,7 @@ hipError_t hipStreamGetFlags(hipStream_t stream, unsigned int *flags) } -hipError_t hipStreamSynchronize(hipStream_t stream) -{ +hipError_t hipStreamSynchronize(hipStream_t stream) { HIP_INIT_API(stream); amd::HostQueue* hostQueue = as_amd(reinterpret_cast(stream))->asHostQueue(); @@ -84,8 +79,7 @@ hipError_t hipStreamSynchronize(hipStream_t stream) } -hipError_t hipStreamDestroy(hipStream_t stream) -{ +hipError_t hipStreamDestroy(hipStream_t stream) { HIP_INIT_API(stream); as_amd(reinterpret_cast(stream))->release(); @@ -94,3 +88,29 @@ hipError_t hipStreamDestroy(hipStream_t stream) } +hipError_t hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int flags) { + HIP_INIT_API(stream, event, flags); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipStreamQuery(hipStream_t stream) { + HIP_INIT_API(stream); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipStreamAddCallback(hipStream_t stream, hipStreamCallback_t callback, void* userData, + unsigned int flags) { + HIP_INIT_API(stream, callback, userData, flags); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + + diff --git a/api/hip/hip_surface.cpp b/api/hip/hip_surface.cpp new file mode 100644 index 0000000000..ecbd9e60b9 --- /dev/null +++ b/api/hip/hip_surface.cpp @@ -0,0 +1,49 @@ +/* +Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +#include + +#include "hip_internal.hpp" +#include + +struct hipSurface { + hipArray* array; + hipResourceDesc resDesc; +}; + +hipError_t hipCreateSurfaceObject(hipSurfaceObject_t* pSurfObject, + const hipResourceDesc* pResDesc) { + HIP_INIT_API(pSurfObject, pResDesc); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + + +hipError_t hipDestroySurfaceObject(hipSurfaceObject_t surfaceObject) { + HIP_INIT_API(surfaceObject); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} \ No newline at end of file diff --git a/api/hip/hip_texture.cpp b/api/hip/hip_texture.cpp new file mode 100644 index 0000000000..330f86a86f --- /dev/null +++ b/api/hip/hip_texture.cpp @@ -0,0 +1,202 @@ +/* +Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +#include +#include +#include "hip_internal.hpp" + +struct hipTexture { + hipResourceDesc resDesc; + hipTextureDesc texDesc; + hipResourceViewDesc resViewDesc; + hsa_ext_image_t image; + hsa_ext_sampler_t sampler; +}; + +hipError_t hipCreateTextureObject(hipTextureObject_t* pTexObject, const hipResourceDesc* pResDesc, + const hipTextureDesc* pTexDesc, + const hipResourceViewDesc* pResViewDesc) { + HIP_INIT_API(pTexObject, pResDesc, pTexDesc, pResViewDesc); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipDestroyTextureObject(hipTextureObject_t textureObject) { + HIP_INIT_API(textureObject); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipGetTextureObjectResourceDesc(hipResourceDesc* pResDesc, + hipTextureObject_t textureObject) { + HIP_INIT_API(pResDesc, textureObject); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipGetTextureObjectResourceViewDesc(hipResourceViewDesc* pResViewDesc, + hipTextureObject_t textureObject) { + HIP_INIT_API(pResViewDesc, textureObject); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipGetTextureObjectTextureDesc(hipTextureDesc* pTexDesc, + hipTextureObject_t textureObject) { + HIP_INIT_API(pTexDesc, textureObject); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipBindTexture(size_t* offset, textureReference* tex, const void* devPtr, + const hipChannelFormatDesc* desc, size_t size) { + HIP_INIT_API(offset, tex, devPtr, desc, size); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipBindTexture2D(size_t* offset, textureReference* tex, const void* devPtr, + const hipChannelFormatDesc* desc, size_t width, size_t height, + size_t pitch) { + HIP_INIT_API(offset, tex, devPtr, desc, width, height, pitch); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipBindTextureToArray(textureReference* tex, hipArray_const_t array, + const hipChannelFormatDesc* desc) { + HIP_INIT_API(tex, array, desc); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipBindTextureToMipmappedArray(textureReference* tex, + hipMipmappedArray_const_t mipmappedArray, + const hipChannelFormatDesc* desc) { + HIP_INIT_API(tex, mipmappedArray, desc); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipUnbindTexture(const textureReference* tex) { + HIP_INIT_API(tex); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipGetChannelDesc(hipChannelFormatDesc* desc, hipArray_const_t array) { + HIP_INIT_API(desc, array); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipGetTextureAlignmentOffset(size_t* offset, const textureReference* tex) { + HIP_INIT_API(offset, tex); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipGetTextureReference(const textureReference** tex, const void* symbol) { + HIP_INIT_API(tex, symbol); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipTexRefSetFormat(textureReference* tex, hipArray_Format fmt, int NumPackedComponents) { + HIP_INIT_API(tex, fmt, NumPackedComponents); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipTexRefSetFlags(textureReference* tex, unsigned int flags) { + HIP_INIT_API(tex, flags); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipTexRefSetFilterMode(textureReference* tex, hipTextureFilterMode fm) { + HIP_INIT_API(tex, fm); +} + +hipError_t hipTexRefSetAddressMode(textureReference* tex, int dim, hipTextureAddressMode am) { + HIP_INIT_API(tex, dim, am); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipTexRefSetArray(textureReference* tex, hipArray_const_t array, unsigned int flags) { + HIP_INIT_API(tex, array, flags); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipTexRefSetAddress(size_t* offset, textureReference* tex, hipDeviceptr_t devPtr, + size_t size) { + HIP_INIT_API(offset, tex, devPtr, size); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} + +hipError_t hipTexRefSetAddress2D(textureReference* tex, const HIP_ARRAY_DESCRIPTOR* desc, + hipDeviceptr_t devPtr, size_t pitch) { + HIP_INIT_API(tex, desc, devPtr, pitch); + + assert(0 && "Unimplemented"); + + return hipErrorUnknown; +} \ No newline at end of file