mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Refactor setArgBufferWithAlloc, add zello_world blackbox test
Change-Id: I793f960582ce8c066dedd466befcbf534d6d7ddc Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
86ea2ffdac
commit
4c23b60b30
@ -281,7 +281,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyFromMemory(ze_i
|
||||
break;
|
||||
}
|
||||
|
||||
builtinKernel->setArgBufferWithAlloc(0u, reinterpret_cast<void *>(&allocationStruct.alignedAllocationPtr),
|
||||
builtinKernel->setArgBufferWithAlloc(0u, allocationStruct.alignedAllocationPtr,
|
||||
allocationStruct.alloc);
|
||||
builtinKernel->setArgRedescribedImage(1u, hDstImage);
|
||||
builtinKernel->setArgumentValue(2u, sizeof(size_t), &allocationStruct.offset);
|
||||
@ -378,7 +378,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyToMemory(void *
|
||||
}
|
||||
|
||||
builtinKernel->setArgRedescribedImage(0u, hSrcImage);
|
||||
builtinKernel->setArgBufferWithAlloc(1u, reinterpret_cast<void *>(&allocationStruct.alignedAllocationPtr),
|
||||
builtinKernel->setArgBufferWithAlloc(1u, allocationStruct.alignedAllocationPtr,
|
||||
allocationStruct.alloc);
|
||||
|
||||
uint32_t origin[] = {
|
||||
@ -566,9 +566,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyKernelWithGA(v
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
builtinFunction->setArgBufferWithAlloc(0u, dstPtr, dstPtrAlloc);
|
||||
|
||||
builtinFunction->setArgBufferWithAlloc(1u, srcPtr, srcPtrAlloc);
|
||||
builtinFunction->setArgBufferWithAlloc(0u, *reinterpret_cast<uintptr_t *>(dstPtr), dstPtrAlloc);
|
||||
builtinFunction->setArgBufferWithAlloc(1u, *reinterpret_cast<uintptr_t *>(srcPtr), srcPtrAlloc);
|
||||
|
||||
uint32_t elems = size / elementSize;
|
||||
builtinFunction->setArgumentValue(2, sizeof(elems), &elems);
|
||||
@ -639,8 +638,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendPageFaultCopy(NEO::Graph
|
||||
auto dstValPtr = static_cast<uintptr_t>(dstptr->getGpuAddress());
|
||||
auto srcValPtr = static_cast<uintptr_t>(srcptr->getGpuAddress());
|
||||
|
||||
builtinFunction->setArgBufferWithAlloc(0, reinterpret_cast<void *>(&dstValPtr), dstptr);
|
||||
builtinFunction->setArgBufferWithAlloc(1, reinterpret_cast<void *>(&srcValPtr), srcptr);
|
||||
builtinFunction->setArgBufferWithAlloc(0, dstValPtr, dstptr);
|
||||
builtinFunction->setArgBufferWithAlloc(1, srcValPtr, srcptr);
|
||||
builtinFunction->setArgumentValue(2, sizeof(size), &size);
|
||||
|
||||
uint32_t groups = (static_cast<uint32_t>(size) + ((groupSizeX)-1)) / (groupSizeX);
|
||||
@ -854,8 +853,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyKernel3d(NEO::
|
||||
auto dstValPtr = static_cast<uintptr_t>(dstGA->getGpuAddress());
|
||||
auto srcValPtr = static_cast<uintptr_t>(srcGA->getGpuAddress());
|
||||
|
||||
builtinFunction->setArgBufferWithAlloc(0, reinterpret_cast<void *>(&srcValPtr), srcGA);
|
||||
builtinFunction->setArgBufferWithAlloc(1, reinterpret_cast<void *>(&dstValPtr), dstGA);
|
||||
builtinFunction->setArgBufferWithAlloc(0, srcValPtr, srcGA);
|
||||
builtinFunction->setArgBufferWithAlloc(1, dstValPtr, dstGA);
|
||||
builtinFunction->setArgumentValue(2, sizeof(srcOrigin), &srcOrigin);
|
||||
builtinFunction->setArgumentValue(3, sizeof(dstOrigin), &dstOrigin);
|
||||
builtinFunction->setArgumentValue(4, sizeof(srcPitches), &srcPitches);
|
||||
@ -909,8 +908,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyKernel2d(NEO::
|
||||
auto dstValPtr = static_cast<uintptr_t>(dstGA->getGpuAddress());
|
||||
auto srcValPtr = static_cast<uintptr_t>(srcGA->getGpuAddress());
|
||||
|
||||
builtinFunction->setArgBufferWithAlloc(0, reinterpret_cast<void *>(&srcValPtr), srcGA);
|
||||
builtinFunction->setArgBufferWithAlloc(1, reinterpret_cast<void *>(&dstValPtr), dstGA);
|
||||
builtinFunction->setArgBufferWithAlloc(0, srcValPtr, srcGA);
|
||||
builtinFunction->setArgBufferWithAlloc(1, dstValPtr, dstGA);
|
||||
builtinFunction->setArgumentValue(2, sizeof(srcOrigin), &srcOrigin);
|
||||
builtinFunction->setArgumentValue(3, sizeof(dstOrigin), &dstOrigin);
|
||||
builtinFunction->setArgumentValue(4, sizeof(srcPitch), &srcPitch);
|
||||
|
@ -96,7 +96,7 @@ struct Kernel : _ze_kernel_handle_t, virtual NEO::DispatchKernelEncoderI {
|
||||
virtual ze_result_t setArgumentValue(uint32_t argIndex, size_t argSize, const void *pArgValue) = 0;
|
||||
virtual void setGroupCount(uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) = 0;
|
||||
|
||||
virtual ze_result_t setArgBufferWithAlloc(uint32_t argIndex, const void *argVal, NEO::GraphicsAllocation *allocation) = 0;
|
||||
virtual ze_result_t setArgBufferWithAlloc(uint32_t argIndex, uintptr_t argVal, NEO::GraphicsAllocation *allocation) = 0;
|
||||
virtual ze_result_t setArgRedescribedImage(uint32_t argIndex, ze_image_handle_t argVal) = 0;
|
||||
virtual ze_result_t setGroupSize(uint32_t groupSizeX, uint32_t groupSizeY,
|
||||
uint32_t groupSizeZ) = 0;
|
||||
|
@ -413,9 +413,9 @@ ze_result_t KernelImp::setArgRedescribedImage(uint32_t argIndex, ze_image_handle
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ze_result_t KernelImp::setArgBufferWithAlloc(uint32_t argIndex, const void *argVal, NEO::GraphicsAllocation *allocation) {
|
||||
ze_result_t KernelImp::setArgBufferWithAlloc(uint32_t argIndex, uintptr_t argVal, NEO::GraphicsAllocation *allocation) {
|
||||
const auto &arg = kernelImmData->getDescriptor().payloadMappings.explicitArgs[argIndex].as<NEO::ArgDescPointer>();
|
||||
const auto val = *reinterpret_cast<const uintptr_t *>(argVal);
|
||||
const auto val = argVal;
|
||||
|
||||
NEO::patchPointer(ArrayRef<uint8_t>(crossThreadData.get(), crossThreadDataSize), arg, val);
|
||||
if (NEO::isValidOffset(arg.bindful)) {
|
||||
@ -460,8 +460,8 @@ ze_result_t KernelImp::setArgBuffer(uint32_t argIndex, size_t argSize, const voi
|
||||
auto requestedAddress = *reinterpret_cast<void *const *>(argVal);
|
||||
auto svmAllocsManager = module->getDevice()->getDriverHandle()->getSvmAllocsManager();
|
||||
NEO::GraphicsAllocation *alloc = svmAllocsManager->getSVMAllocs()->get(requestedAddress)->gpuAllocation;
|
||||
|
||||
return setArgBufferWithAlloc(argIndex, argVal, alloc);
|
||||
auto gpuAddress = reinterpret_cast<uintptr_t>(requestedAddress);
|
||||
return setArgBufferWithAlloc(argIndex, gpuAddress, alloc);
|
||||
}
|
||||
|
||||
ze_result_t KernelImp::setArgImage(uint32_t argIndex, size_t argSize, const void *argVal) {
|
||||
|
@ -64,7 +64,7 @@ struct KernelImp : Kernel {
|
||||
|
||||
ze_result_t setArgRedescribedImage(uint32_t argIndex, ze_image_handle_t argVal) override;
|
||||
|
||||
ze_result_t setArgBufferWithAlloc(uint32_t argIndex, const void *argVal, NEO::GraphicsAllocation *allocation) override;
|
||||
ze_result_t setArgBufferWithAlloc(uint32_t argIndex, uintptr_t argVal, NEO::GraphicsAllocation *allocation) override;
|
||||
|
||||
ze_result_t setArgImage(uint32_t argIndex, size_t argSize, const void *argVal);
|
||||
|
||||
|
23
level_zero/core/test/black_box_tests/CMakeLists.txt
Normal file
23
level_zero/core/test/black_box_tests/CMakeLists.txt
Normal file
@ -0,0 +1,23 @@
|
||||
#
|
||||
# Copyright (C) 2020 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" AND WIN32)
|
||||
set(L0_BLACK_BOX_TEST_PROJECT_FOLDER "ze_intel_gpu/black_box_tests")
|
||||
set(TEST_NAME zello_world)
|
||||
|
||||
add_executable(${TEST_NAME} zello_world.cpp)
|
||||
|
||||
set_target_properties(${TEST_NAME}
|
||||
PROPERTIES
|
||||
VS_DEBUGGER_COMMAND "$(TargetPath)"
|
||||
VS_DEBUGGER_COMMAND_ARGUMENTS ""
|
||||
VS_DEBUGGER_WORKING_DIRECTORY "$(OutputPath)"
|
||||
)
|
||||
|
||||
add_dependencies(${TEST_NAME} ${TARGET_NAME_L0})
|
||||
target_link_libraries(${TEST_NAME} PUBLIC ${TARGET_NAME_L0})
|
||||
set_target_properties(${TEST_NAME} PROPERTIES FOLDER ${L0_BLACK_BOX_TEST_PROJECT_FOLDER})
|
||||
endif()
|
Reference in New Issue
Block a user