d8a344113f
SWDEV-145570 - [HIP] - Hip Rearchitecture - Rename cuda* launch functions -> hip* - Add more function prototypes to compile the HIP tests Affected files ... ... //depot/stg/opencl/drivers/opencl/api/hip/hip_context.cpp#2 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_device.cpp#3 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_hcc.def.in#2 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_hcc.map.in#2 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_memory.cpp#4 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_module.cpp#2 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_platform.cpp#2 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_stream.cpp#1 add
72 строки
2.1 KiB
C++
72 строки
2.1 KiB
C++
/*
|
|
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 <hip/hip_runtime.h>
|
|
|
|
#include "hip_internal.hpp"
|
|
#include "platform/runtime.hpp"
|
|
#include "utils/versions.hpp"
|
|
|
|
|
|
amd::Context* g_context = nullptr;
|
|
|
|
hipError_t hipInit(unsigned int flags)
|
|
{
|
|
HIP_INIT_API(flags);
|
|
|
|
if (!amd::Runtime::initialized()) {
|
|
amd::Runtime::init();
|
|
}
|
|
|
|
// FIXME: move the global VDI context to hipInit.
|
|
g_context = new amd::Context(
|
|
amd::Device::getDevices(CL_DEVICE_TYPE_GPU, false), amd::Context::Info());
|
|
if (!g_context) return hipErrorOutOfMemory;
|
|
|
|
if (g_context && CL_SUCCESS != g_context->create(nullptr)) {
|
|
g_context->release();
|
|
return hipErrorUnknown;
|
|
}
|
|
|
|
return hipSuccess;
|
|
}
|
|
|
|
hipError_t hipCtxCreate(hipCtx_t *ctx, unsigned int flags, hipDevice_t device)
|
|
{
|
|
HIP_INIT_API(ctx, flags, device);
|
|
|
|
return hipSuccess;
|
|
}
|
|
|
|
hipError_t hipRuntimeGetVersion(int *runtimeVersion)
|
|
{
|
|
HIP_INIT_API(runtimeVersion);
|
|
|
|
if (!runtimeVersion) {
|
|
return hipErrorInvalidValue;
|
|
}
|
|
|
|
*runtimeVersion = AMD_PLATFORM_BUILD_NUMBER;
|
|
|
|
return hipSuccess;
|
|
}
|