Switch to new version of GT-Pin headers

Change-Id: I909d1c578b4b9c3d7e24d3e33a9bfd86a815ab14
This commit is contained in:
hjnapiat
2018-01-12 15:00:36 +01:00
committed by sys_ocldev
parent af77720f9c
commit 111897132e
9 changed files with 34 additions and 56 deletions

View File

@ -113,7 +113,7 @@ if(ARTIFACTS_DIR)
endif(ARTIFACTS_DIR)
if(NOT GTPIN_HEADERS_DIR)
if ((EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../internal/gtpin/gtpin_dx11_interface.h") AND (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../internal/gtpin/gtpin_driver_common.h"))
if ((EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../internal/gtpin/gtpin_ocl_interface.h") AND (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../internal/gtpin/gtpin_driver_common.h"))
get_filename_component(GTPIN_HEADERS_DIR "../internal/gtpin/" ABSOLUTE)
message(STATUS "GT-Pin headers dir: ${GTPIN_HEADERS_DIR}")
endif()

View File

@ -36,7 +36,7 @@ components:
internal:
branch: master
dest_dir: internal
revision: 0eff1e75599adcc562a6a491d53172949f94d4eb
revision: 2f5771ae1b1110c5b9df6afa56121489e105706c
type: git
khronos:
branch: master

View File

@ -20,7 +20,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "gtpin_dx11_interface.h"
#include "gtpin_ocl_interface.h"
#include "runtime/gtpin/gtpin_hw_helper.h"
namespace OCLRT {

View File

@ -20,7 +20,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "gtpin_dx11_interface.h"
#include "gtpin_ocl_interface.h"
#include "runtime/gtpin/gtpin_hw_helper.h"
namespace OCLRT {

View File

@ -21,7 +21,7 @@
*/
#include "config.h"
#include "gtpin_dx11_interface.h"
#include "gtpin_ocl_interface.h"
#include "CL/cl.h"
#include "runtime/device/device.h"
#include "runtime/device/device_info.h"
@ -32,7 +32,7 @@ using namespace gtpin;
namespace OCLRT {
extern bool isGTPinInitialized;
extern gtpin::dx11::gtpin_events_t GTPinCallbacks;
extern gtpin::ocl::gtpin_events_t GTPinCallbacks;
igc_init_t *pIgcInfo = nullptr;

View File

@ -22,7 +22,7 @@
*/
#include "config.h"
#include "gtpin_dx11_interface.h"
#include "gtpin_ocl_interface.h"
#include "gtpin_helpers.h"
#include "CL/cl.h"
#include "runtime/context/context.h"

View File

@ -33,17 +33,17 @@ using namespace OCLRT;
namespace OCLRT {
bool isGTPinInitialized = false;
gtpin::dx11::gtpin_events_t GTPinCallbacks = {0};
gtpin::ocl::gtpin_events_t GTPinCallbacks = {0};
}
GTPIN_DI_STATUS GTPin_Init(gtpin::dx11::gtpin_events_t *pGtpinEvents, driver_services_t *pDriverServices,
GTPIN_DI_STATUS GTPin_Init(gtpin::ocl::gtpin_events_t *pGtpinEvents, driver_services_t *pDriverServices,
uint32_t *pDriverVersion) {
if (isGTPinInitialized) {
return GTPIN_DI_ERROR_INSTANCE_ALREADY_CREATED;
}
if (pDriverVersion != nullptr) {
// GT-Pin is asking to obtain GT-Pin Interface version that is supported
*pDriverVersion = gtpin::dx11::GTPIN_DX11_INTERFACE_VERSION;
*pDriverVersion = gtpin::ocl::GTPIN_OCL_INTERFACE_VERSION;
if ((pDriverServices == nullptr) || (pGtpinEvents == nullptr)) {
return GTPIN_DI_SUCCESS;
@ -55,10 +55,9 @@ GTPIN_DI_STATUS GTPin_Init(gtpin::dx11::gtpin_events_t *pGtpinEvents, driver_ser
if ((pGtpinEvents->onContextCreate == nullptr) ||
(pGtpinEvents->onContextDestroy == nullptr) ||
(pGtpinEvents->onKernelCreate == nullptr) ||
(pGtpinEvents->onDraw == nullptr) ||
(pGtpinEvents->onKernelSubmit == nullptr) ||
(pGtpinEvents->onCommandBufferCreate == nullptr) ||
(pGtpinEvents->onCommandBufferSubmit == nullptr)) {
(pGtpinEvents->onCommandBufferComplete == nullptr)) {
return GTPIN_DI_ERROR_INVALID_ARGUMENT;
}

View File

@ -21,13 +21,13 @@
*/
#pragma once
#include "gtpin_dx11_interface.h"
#include "gtpin_ocl_interface.h"
#ifdef __cplusplus
extern "C" {
#endif
gtpin::GTPIN_DI_STATUS GTPin_Init(gtpin::dx11::gtpin_events_t *pGtpinEvents, gtpin::driver_services_t *pDriverServices, uint32_t *pDriverVersion);
gtpin::GTPIN_DI_STATUS GTPin_Init(gtpin::ocl::gtpin_events_t *pGtpinEvents, gtpin::driver_services_t *pDriverServices, uint32_t *pDriverVersion);
#ifdef __cplusplus
}

View File

@ -57,16 +57,13 @@ void OnContextDestroy(context_handle_t context) {
void OnKernelCreate(context_handle_t context, const instrument_params_in_t *paramsIn, instrument_params_out_t *paramsOut) {
}
void OnDraw(gtpin::dx11::command_buffer_handle_t cb) {
void OnKernelSubmit(command_buffer_handle_t cb, uint64_t kernelId, uint32_t *entryOffset, resource_handle_t *resource) {
}
void OnKernelSubmit(gtpin::dx11::command_buffer_handle_t cb, uint64_t kernelId, uint32_t *entryOffset, resource_handle_t *resource) {
void OnCommandBufferCreate(context_handle_t context, command_buffer_handle_t cb) {
}
void OnCommandBufferCreate(context_handle_t context, gtpin::dx11::command_buffer_handle_t cb) {
}
void OnCommandBufferSubmit(gtpin::dx11::command_buffer_handle_t cb, resource_handle_t *resource) {
void OnCommandBufferComplete(command_buffer_handle_t cb) {
}
class GTPinFixture : public ContextFixture, public MemoryManagementFixture {
@ -93,10 +90,9 @@ class GTPinFixture : public ContextFixture, public MemoryManagementFixture {
gtpinCallbacks.onContextCreate = nullptr;
gtpinCallbacks.onContextDestroy = nullptr;
gtpinCallbacks.onKernelCreate = nullptr;
gtpinCallbacks.onDraw = nullptr;
gtpinCallbacks.onKernelSubmit = nullptr;
gtpinCallbacks.onCommandBufferCreate = nullptr;
gtpinCallbacks.onCommandBufferSubmit = nullptr;
gtpinCallbacks.onCommandBufferComplete = nullptr;
OCLRT::isGTPinInitialized = false;
}
@ -113,7 +109,7 @@ class GTPinFixture : public ContextFixture, public MemoryManagementFixture {
cl_int retVal = CL_SUCCESS;
GTPIN_DI_STATUS retFromGtPin = GTPIN_DI_SUCCESS;
driver_services_t driverServices;
gtpin::dx11::gtpin_events_t gtpinCallbacks;
gtpin::ocl::gtpin_events_t gtpinCallbacks;
};
typedef Test<GTPinFixture> GTPinTests;
@ -147,10 +143,6 @@ TEST_F(GTPinTests, givenIncompleteArgumentsThenGTPinInitFails) {
retFromGtPin = GTPin_Init(&gtpinCallbacks, &driverServices, nullptr);
EXPECT_EQ(GTPIN_DI_ERROR_INVALID_ARGUMENT, retFromGtPin);
gtpinCallbacks.onDraw = OnDraw;
retFromGtPin = GTPin_Init(&gtpinCallbacks, &driverServices, nullptr);
EXPECT_EQ(GTPIN_DI_ERROR_INVALID_ARGUMENT, retFromGtPin);
gtpinCallbacks.onKernelSubmit = OnKernelSubmit;
retFromGtPin = GTPin_Init(&gtpinCallbacks, &driverServices, nullptr);
EXPECT_EQ(GTPIN_DI_ERROR_INVALID_ARGUMENT, retFromGtPin);
@ -165,25 +157,24 @@ TEST_F(GTPinTests, givenInvalidArgumentsWhenVersionArgumentIsProvidedThenGTPinIn
retFromGtPin = GTPin_Init(nullptr, nullptr, &ver);
EXPECT_EQ(GTPIN_DI_SUCCESS, retFromGtPin);
EXPECT_EQ(gtpin::dx11::GTPIN_DX11_INTERFACE_VERSION, ver);
EXPECT_EQ(gtpin::ocl::GTPIN_OCL_INTERFACE_VERSION, ver);
retFromGtPin = GTPin_Init(&gtpinCallbacks, nullptr, &ver);
EXPECT_EQ(GTPIN_DI_SUCCESS, retFromGtPin);
EXPECT_EQ(gtpin::dx11::GTPIN_DX11_INTERFACE_VERSION, ver);
EXPECT_EQ(gtpin::ocl::GTPIN_OCL_INTERFACE_VERSION, ver);
retFromGtPin = GTPin_Init(nullptr, &driverServices, &ver);
EXPECT_EQ(GTPIN_DI_SUCCESS, retFromGtPin);
EXPECT_EQ(gtpin::dx11::GTPIN_DX11_INTERFACE_VERSION, ver);
EXPECT_EQ(gtpin::ocl::GTPIN_OCL_INTERFACE_VERSION, ver);
}
TEST_F(GTPinTests, givenValidAndCompleteArgumentsThenGTPinInitSucceeds) {
gtpinCallbacks.onContextCreate = OnContextCreate;
gtpinCallbacks.onContextDestroy = OnContextDestroy;
gtpinCallbacks.onKernelCreate = OnKernelCreate;
gtpinCallbacks.onDraw = OnDraw;
gtpinCallbacks.onKernelSubmit = OnKernelSubmit;
gtpinCallbacks.onCommandBufferCreate = OnCommandBufferCreate;
gtpinCallbacks.onCommandBufferSubmit = OnCommandBufferSubmit;
gtpinCallbacks.onCommandBufferComplete = OnCommandBufferComplete;
retFromGtPin = GTPin_Init(&gtpinCallbacks, &driverServices, nullptr);
EXPECT_EQ(GTPIN_DI_SUCCESS, retFromGtPin);
EXPECT_EQ(&OCLRT::gtpinCreateBuffer, driverServices.bufferAllocate);
@ -196,10 +187,9 @@ TEST_F(GTPinTests, givenValidAndCompleteArgumentsWhenGTPinIsAlreadyInitializedTh
gtpinCallbacks.onContextCreate = OnContextCreate;
gtpinCallbacks.onContextDestroy = OnContextDestroy;
gtpinCallbacks.onKernelCreate = OnKernelCreate;
gtpinCallbacks.onDraw = OnDraw;
gtpinCallbacks.onKernelSubmit = OnKernelSubmit;
gtpinCallbacks.onCommandBufferCreate = OnCommandBufferCreate;
gtpinCallbacks.onCommandBufferSubmit = OnCommandBufferSubmit;
gtpinCallbacks.onCommandBufferComplete = OnCommandBufferComplete;
retFromGtPin = GTPin_Init(&gtpinCallbacks, &driverServices, nullptr);
EXPECT_EQ(GTPIN_DI_SUCCESS, retFromGtPin);
EXPECT_EQ(&OCLRT::gtpinCreateBuffer, driverServices.bufferAllocate);
@ -218,10 +208,9 @@ TEST_F(GTPinTests, givenInvalidArgumentsThenBufferAllocateFails) {
gtpinCallbacks.onContextCreate = OnContextCreate;
gtpinCallbacks.onContextDestroy = OnContextDestroy;
gtpinCallbacks.onKernelCreate = OnKernelCreate;
gtpinCallbacks.onDraw = OnDraw;
gtpinCallbacks.onKernelSubmit = OnKernelSubmit;
gtpinCallbacks.onCommandBufferCreate = OnCommandBufferCreate;
gtpinCallbacks.onCommandBufferSubmit = OnCommandBufferSubmit;
gtpinCallbacks.onCommandBufferComplete = OnCommandBufferComplete;
retFromGtPin = GTPin_Init(&gtpinCallbacks, &driverServices, nullptr);
EXPECT_EQ(GTPIN_DI_SUCCESS, retFromGtPin);
ASSERT_EQ(&OCLRT::gtpinCreateBuffer, driverServices.bufferAllocate);
@ -241,10 +230,9 @@ TEST_F(GTPinTests, givenInvalidArgumentsThenBufferDeallocateFails) {
gtpinCallbacks.onContextCreate = OnContextCreate;
gtpinCallbacks.onContextDestroy = OnContextDestroy;
gtpinCallbacks.onKernelCreate = OnKernelCreate;
gtpinCallbacks.onDraw = OnDraw;
gtpinCallbacks.onKernelSubmit = OnKernelSubmit;
gtpinCallbacks.onCommandBufferCreate = OnCommandBufferCreate;
gtpinCallbacks.onCommandBufferSubmit = OnCommandBufferSubmit;
gtpinCallbacks.onCommandBufferComplete = OnCommandBufferComplete;
retFromGtPin = GTPin_Init(&gtpinCallbacks, &driverServices, nullptr);
EXPECT_EQ(GTPIN_DI_SUCCESS, retFromGtPin);
EXPECT_EQ(&OCLRT::gtpinCreateBuffer, driverServices.bufferAllocate);
@ -267,10 +255,9 @@ TEST_F(GTPinTests, givenInvalidArgumentsThenBufferMapFails) {
gtpinCallbacks.onContextCreate = OnContextCreate;
gtpinCallbacks.onContextDestroy = OnContextDestroy;
gtpinCallbacks.onKernelCreate = OnKernelCreate;
gtpinCallbacks.onDraw = OnDraw;
gtpinCallbacks.onKernelSubmit = OnKernelSubmit;
gtpinCallbacks.onCommandBufferCreate = OnCommandBufferCreate;
gtpinCallbacks.onCommandBufferSubmit = OnCommandBufferSubmit;
gtpinCallbacks.onCommandBufferComplete = OnCommandBufferComplete;
retFromGtPin = GTPin_Init(&gtpinCallbacks, &driverServices, nullptr);
EXPECT_EQ(GTPIN_DI_SUCCESS, retFromGtPin);
EXPECT_EQ(&OCLRT::gtpinCreateBuffer, driverServices.bufferAllocate);
@ -294,10 +281,9 @@ TEST_F(GTPinTests, givenInvalidArgumentsThenBufferUnMapFails) {
gtpinCallbacks.onContextCreate = OnContextCreate;
gtpinCallbacks.onContextDestroy = OnContextDestroy;
gtpinCallbacks.onKernelCreate = OnKernelCreate;
gtpinCallbacks.onDraw = OnDraw;
gtpinCallbacks.onKernelSubmit = OnKernelSubmit;
gtpinCallbacks.onCommandBufferCreate = OnCommandBufferCreate;
gtpinCallbacks.onCommandBufferSubmit = OnCommandBufferSubmit;
gtpinCallbacks.onCommandBufferComplete = OnCommandBufferComplete;
retFromGtPin = GTPin_Init(&gtpinCallbacks, &driverServices, nullptr);
EXPECT_EQ(GTPIN_DI_SUCCESS, retFromGtPin);
EXPECT_EQ(&OCLRT::gtpinCreateBuffer, driverServices.bufferAllocate);
@ -336,10 +322,9 @@ TEST_F(GTPinTests, givenValidRequestForHugeMemoryAllocationThenBufferAllocateFai
gtpinCallbacks.onContextCreate = OnContextCreate;
gtpinCallbacks.onContextDestroy = OnContextDestroy;
gtpinCallbacks.onKernelCreate = OnKernelCreate;
gtpinCallbacks.onDraw = OnDraw;
gtpinCallbacks.onKernelSubmit = OnKernelSubmit;
gtpinCallbacks.onCommandBufferCreate = OnCommandBufferCreate;
gtpinCallbacks.onCommandBufferSubmit = OnCommandBufferSubmit;
gtpinCallbacks.onCommandBufferComplete = OnCommandBufferComplete;
retFromGtPin = GTPin_Init(&gtpinCallbacks, &driverServices, nullptr);
EXPECT_EQ(GTPIN_DI_SUCCESS, retFromGtPin);
ASSERT_EQ(&OCLRT::gtpinCreateBuffer, driverServices.bufferAllocate);
@ -357,10 +342,9 @@ TEST_F(GTPinTests, givenValidRequestForMemoryAllocationThenBufferAllocateAndDeal
gtpinCallbacks.onContextCreate = OnContextCreate;
gtpinCallbacks.onContextDestroy = OnContextDestroy;
gtpinCallbacks.onKernelCreate = OnKernelCreate;
gtpinCallbacks.onDraw = OnDraw;
gtpinCallbacks.onKernelSubmit = OnKernelSubmit;
gtpinCallbacks.onCommandBufferCreate = OnCommandBufferCreate;
gtpinCallbacks.onCommandBufferSubmit = OnCommandBufferSubmit;
gtpinCallbacks.onCommandBufferComplete = OnCommandBufferComplete;
retFromGtPin = GTPin_Init(&gtpinCallbacks, &driverServices, nullptr);
EXPECT_EQ(GTPIN_DI_SUCCESS, retFromGtPin);
ASSERT_EQ(&OCLRT::gtpinCreateBuffer, driverServices.bufferAllocate);
@ -384,10 +368,9 @@ TEST_F(GTPinTests, givenValidArgumentsForBufferMapWhenCallSequenceIsCorrectThenB
gtpinCallbacks.onContextCreate = OnContextCreate;
gtpinCallbacks.onContextDestroy = OnContextDestroy;
gtpinCallbacks.onKernelCreate = OnKernelCreate;
gtpinCallbacks.onDraw = OnDraw;
gtpinCallbacks.onKernelSubmit = OnKernelSubmit;
gtpinCallbacks.onCommandBufferCreate = OnCommandBufferCreate;
gtpinCallbacks.onCommandBufferSubmit = OnCommandBufferSubmit;
gtpinCallbacks.onCommandBufferComplete = OnCommandBufferComplete;
retFromGtPin = GTPin_Init(&gtpinCallbacks, &driverServices, nullptr);
EXPECT_EQ(GTPIN_DI_SUCCESS, retFromGtPin);
ASSERT_EQ(&OCLRT::gtpinCreateBuffer, driverServices.bufferAllocate);
@ -416,10 +399,9 @@ TEST_F(GTPinTests, givenMissingReturnArgumentForBufferMapWhenCallSequenceIsCorre
gtpinCallbacks.onContextCreate = OnContextCreate;
gtpinCallbacks.onContextDestroy = OnContextDestroy;
gtpinCallbacks.onKernelCreate = OnKernelCreate;
gtpinCallbacks.onDraw = OnDraw;
gtpinCallbacks.onKernelSubmit = OnKernelSubmit;
gtpinCallbacks.onCommandBufferCreate = OnCommandBufferCreate;
gtpinCallbacks.onCommandBufferSubmit = OnCommandBufferSubmit;
gtpinCallbacks.onCommandBufferComplete = OnCommandBufferComplete;
retFromGtPin = GTPin_Init(&gtpinCallbacks, &driverServices, nullptr);
EXPECT_EQ(GTPIN_DI_SUCCESS, retFromGtPin);
ASSERT_EQ(&OCLRT::gtpinCreateBuffer, driverServices.bufferAllocate);
@ -446,10 +428,9 @@ TEST_F(GTPinTests, givenValidArgumentsForBufferUnMapWhenCallSequenceIsCorrectThe
gtpinCallbacks.onContextCreate = OnContextCreate;
gtpinCallbacks.onContextDestroy = OnContextDestroy;
gtpinCallbacks.onKernelCreate = OnKernelCreate;
gtpinCallbacks.onDraw = OnDraw;
gtpinCallbacks.onKernelSubmit = OnKernelSubmit;
gtpinCallbacks.onCommandBufferCreate = OnCommandBufferCreate;
gtpinCallbacks.onCommandBufferSubmit = OnCommandBufferSubmit;
gtpinCallbacks.onCommandBufferComplete = OnCommandBufferComplete;
retFromGtPin = GTPin_Init(&gtpinCallbacks, &driverServices, nullptr);
EXPECT_EQ(GTPIN_DI_SUCCESS, retFromGtPin);
ASSERT_EQ(&OCLRT::gtpinCreateBuffer, driverServices.bufferAllocate);
@ -492,10 +473,9 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenContextCreationArgumentsAre
gtpinCallbacks.onContextCreate = OnContextCreate;
gtpinCallbacks.onContextDestroy = OnContextDestroy;
gtpinCallbacks.onKernelCreate = OnKernelCreate;
gtpinCallbacks.onDraw = OnDraw;
gtpinCallbacks.onKernelSubmit = OnKernelSubmit;
gtpinCallbacks.onCommandBufferCreate = OnCommandBufferCreate;
gtpinCallbacks.onCommandBufferSubmit = OnCommandBufferSubmit;
gtpinCallbacks.onCommandBufferComplete = OnCommandBufferComplete;
retFromGtPin = GTPin_Init(&gtpinCallbacks, &driverServices, nullptr);
EXPECT_EQ(GTPIN_DI_SUCCESS, retFromGtPin);
@ -517,10 +497,9 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceThenGTPinContextCallbackIsCalle
gtpinCallbacks.onContextCreate = OnContextCreate;
gtpinCallbacks.onContextDestroy = OnContextDestroy;
gtpinCallbacks.onKernelCreate = OnKernelCreate;
gtpinCallbacks.onDraw = OnDraw;
gtpinCallbacks.onKernelSubmit = OnKernelSubmit;
gtpinCallbacks.onCommandBufferCreate = OnCommandBufferCreate;
gtpinCallbacks.onCommandBufferSubmit = OnCommandBufferSubmit;
gtpinCallbacks.onCommandBufferComplete = OnCommandBufferComplete;
retFromGtPin = GTPin_Init(&gtpinCallbacks, &driverServices, nullptr);
EXPECT_EQ(GTPIN_DI_SUCCESS, retFromGtPin);