Implement hsaKmtGetTileConfig in thunk
Change-Id: Iba8d8efa46e3c268a03442d3db568e1b19230e94
[ROCm/ROCR-Runtime commit: 8351b3d2e8]
This commit is contained in:
@@ -651,6 +651,16 @@ hsaKmtSetTrapHandler(
|
||||
HSAuint64 TrapBufferSizeInBytes //IN
|
||||
);
|
||||
|
||||
/**
|
||||
Gets image tile configuration.
|
||||
*/
|
||||
HSAKMT_STATUS
|
||||
HSAKMTAPI
|
||||
hsaKmtGetTileConfig(
|
||||
HSAuint32 NodeId, // IN
|
||||
HsaGpuTileConfig* config // IN & OUT
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} //extern "C"
|
||||
#endif
|
||||
|
||||
@@ -967,6 +967,21 @@ typedef struct _HsaPmcTraceRoot
|
||||
HSATraceId TraceId;
|
||||
} HsaPmcTraceRoot;
|
||||
|
||||
typedef struct _HsaGpuTileConfig
|
||||
{
|
||||
const HSAuint32 *TileConfig;
|
||||
const HSAuint32 *MacroTileConfig;
|
||||
HSAuint32 NumTileConfigs;
|
||||
HSAuint32 NumMacroTileConfigs;
|
||||
|
||||
HSAuint32 GbAddrConfig;
|
||||
|
||||
HSAuint32 NumBanks;
|
||||
HSAuint32 NumRanks;
|
||||
/* 9 dwords on 64-bit system */
|
||||
HSAuint32 Reserved[7]; /* Round up to 16 dwords for future extension */
|
||||
} HsaGpuTileConfig;
|
||||
|
||||
#pragma pack(pop, hsakmttypes_h)
|
||||
|
||||
|
||||
|
||||
@@ -364,6 +364,29 @@ struct kfd_ioctl_import_dmabuf_args {
|
||||
uint32_t dmabuf_fd; /* to KFD */
|
||||
};
|
||||
|
||||
struct kfd_ioctl_get_tile_config_args {
|
||||
/* to KFD: pointer to tile array */
|
||||
uint64_t tile_config_ptr;
|
||||
/* to KFD: pointer to macro tile array */
|
||||
uint64_t macro_tile_config_ptr;
|
||||
/* to KFD: array size allocated by user mode
|
||||
* from KFD: array size filled by kernel
|
||||
*/
|
||||
uint32_t num_tile_configs;
|
||||
/* to KFD: array size allocated by user mode
|
||||
* from KFD: array size filled by kernel
|
||||
*/
|
||||
uint32_t num_macro_tile_configs;
|
||||
|
||||
uint32_t gpu_id; /* to KFD */
|
||||
uint32_t gb_addr_config; /* from KFD */
|
||||
uint32_t num_banks; /* from KFD */
|
||||
uint32_t num_ranks; /* from KFD */
|
||||
/* struct size can be extended later if needed
|
||||
* without breaking ABI compatibility
|
||||
*/
|
||||
};
|
||||
|
||||
#define AMDKFD_IOCTL_BASE 'K'
|
||||
#define AMDKFD_IO(nr) _IO(AMDKFD_IOCTL_BASE, nr)
|
||||
#define AMDKFD_IOR(nr, type) _IOR(AMDKFD_IOCTL_BASE, nr, type)
|
||||
@@ -466,7 +489,10 @@ struct kfd_ioctl_import_dmabuf_args {
|
||||
#define AMDKFD_IOC_IMPORT_DMABUF \
|
||||
AMDKFD_IOWR(0x20, struct kfd_ioctl_import_dmabuf_args)
|
||||
|
||||
#define AMDKFD_IOC_GET_TILE_CONFIG \
|
||||
AMDKFD_IOWR(0x21, struct kfd_ioctl_get_tile_config_args)
|
||||
|
||||
#define AMDKFD_COMMAND_START 0x01
|
||||
#define AMDKFD_COMMAND_END 0x21
|
||||
#define AMDKFD_COMMAND_END 0x22
|
||||
|
||||
#endif
|
||||
|
||||
@@ -47,6 +47,7 @@ hsaKmtPmcStopTrace;
|
||||
hsaKmtMapGraphicHandle;
|
||||
hsaKmtUnmapGraphicHandle;
|
||||
hsaKmtSetTrapHandler;
|
||||
hsaKmtGetTileConfig;
|
||||
|
||||
local: *;
|
||||
};
|
||||
|
||||
@@ -386,3 +386,39 @@ hsaKmtUnmapGraphicHandle(
|
||||
|
||||
return hsaKmtUnmapMemoryToGPU(PORT_UINT64_TO_VPTR(FlatMemoryAddress));
|
||||
}
|
||||
|
||||
HSAKMT_STATUS
|
||||
HSAKMTAPI
|
||||
hsaKmtGetTileConfig(
|
||||
HSAuint32 NodeId, /* IN */
|
||||
HsaGpuTileConfig *config /* IN & OUT */
|
||||
)
|
||||
{
|
||||
struct kfd_ioctl_get_tile_config_args args;
|
||||
uint32_t gpu_id;
|
||||
HSAKMT_STATUS result;
|
||||
|
||||
result = validate_nodeid(NodeId, &gpu_id);
|
||||
if (result != HSAKMT_STATUS_SUCCESS)
|
||||
return result;
|
||||
|
||||
args.gpu_id = gpu_id;
|
||||
args.tile_config_ptr = (uint64_t)config->TileConfig;
|
||||
args.macro_tile_config_ptr = (uint64_t)config->MacroTileConfig;
|
||||
args.num_tile_configs = config->NumTileConfigs;
|
||||
args.num_macro_tile_configs = config->NumMacroTileConfigs;
|
||||
|
||||
if (kmtIoctl(kfd_fd, AMDKFD_IOC_GET_TILE_CONFIG, &args) != 0) {
|
||||
return HSAKMT_STATUS_ERROR;
|
||||
}
|
||||
|
||||
config->NumTileConfigs = args.num_tile_configs;
|
||||
config->NumMacroTileConfigs = args.num_macro_tile_configs;
|
||||
|
||||
config->GbAddrConfig = args.gb_addr_config;
|
||||
|
||||
config->NumBanks = args.num_banks;
|
||||
config->NumRanks = args.num_ranks;
|
||||
|
||||
return HSAKMT_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
Viittaa uudesa ongelmassa
Block a user