Callback Params¶
ha_callback_params.h는 특정 Ha* 호출이 계측(instrument)될 때 그 호출의 인자를 담아
콜백으로 넘기기 위한 구조체 모음입니다. 아래 구조체는 각각 하나의 Ha* 호출에
대응하며, 필드는 그 호출에 전달된 인자를 그대로 담습니다.
이 구조체를 실제로 채우고 등록된 구독자에게 넘기는 진입/종료 훅과 구독 등록
API(HaApiEnter/HaApiExit/HaSubscribe/HaUnsubscribe)는 hart(runtime)가
아니라 별도 컴포넌트(interceptor)가 소유하므로 이 페이지에서 다루지 않습니다.
Contents¶
| 파라미터 구조체 (Params) | 대응하는 런타임 API 함수 |
|---|---|
HaSetDeviceParams |
HaSetDevice |
HaResetDeviceParams |
HaResetDevice |
HaResetAllDevicesParams |
HaResetAllDevices |
HaMemAllocParams |
HaMemAlloc, HaMemAlloc3D |
HaMemAllocAsyncParams |
HaMemAllocAsync |
HaMemFreeParams |
HaMemFree |
HaMemFreeAsyncParams |
HaMemFreeAsync |
HaMemCpyParams |
HaMemCpy |
HaMemCpyAsyncParams |
HaMemCpyAsync |
HaMemCpyNdParams |
HaMemCpyNd |
HaMemCpyNdAsyncParams |
HaMemCpyNdAsync |
HaMemLoadFileAsyncParams |
HaMemLoadFileAsync |
HaLibraryLoadDataParams |
HaLibraryLoadData |
HaLaunchKernelParams |
HaLaunchKernel |
HaLaunchKernelAsyncParams |
HaLaunchKernelAsync |
HaStreamParams |
HaStreamSynchronize, HaStreamQuery |
HaStreamWaitEventParams |
HaStreamWaitEvent |
HaEventRecordParams |
HaEventRecord |
HaEventParams |
HaEventSynchronize, HaEventQuery |
HaSetDeviceParams¶
Args for HaSetDevice.
| Field | Type | Description |
|---|---|---|
device_id |
int |
Target device index. |
HaResetDeviceParams¶
Args for HaResetDevice.
| Field | Type | Description |
|---|---|---|
device_id |
int |
Target device index. |
HaResetAllDevicesParams¶
Args for HaResetAllDevices. HaResetAllDevices takes no arguments; the field exists only because an empty struct is not valid C.
| Field | Type | Description |
|---|---|---|
reserved |
uint8_t |
Unused; always 0. |
HaMemAllocParams¶
Args for HaMemAlloc and HaMemAlloc3D.
| Field | Type | Description |
|---|---|---|
ptr |
uint64_t * |
Out device pointer (HaDevicePtr*). |
size |
size_t |
Allocation size in bytes (1-D variant; 0 when is_3d). |
is_interleaved |
int |
Non-zero if interleaved across channels. |
is_3d |
int |
Non-zero for the HaMemAlloc3D variant (w / h / c valid). |
w |
size_t |
3D width (valid when is_3d). |
h |
size_t |
3D height (valid when is_3d). |
c |
size_t |
3D channel (valid when is_3d). |
Note
is_3d가 어느 필드가 유효한지를 결정합니다: 0이면 size 바이트짜리 평면
버퍼(HaMemAlloc)이고, 1이면 3D shape(HaMemAlloc3D)이라 w/h/c가
유효하고 size는 0입니다.
HaMemAllocAsyncParams¶
Args for HaMemAllocAsync.
| Field | Type | Description |
|---|---|---|
ptr |
uint64_t * |
Out device pointer (HaDevicePtr*). |
size |
size_t |
Allocation size in bytes. |
is_interleaved |
int |
Non-zero if interleaved across channels. |
stream |
void * |
Stream the allocation is enqueued on (HaStream_t). |
HaMemFreeParams¶
Args for HaMemFree.
| Field | Type | Description |
|---|---|---|
ptr |
uint64_t |
Device pointer to free (HaDevicePtr). |
HaMemFreeAsyncParams¶
Args for HaMemFreeAsync.
| Field | Type | Description |
|---|---|---|
ptr |
uint64_t |
Device pointer to free (HaDevicePtr). |
stream |
void * |
Stream the free is enqueued on (HaStream_t). |
HaMemCpyParams¶
Args for HaMemCpy.
| Field | Type | Description |
|---|---|---|
dst |
uint64_t |
Destination pointer (HaDevicePtr). |
src |
uint64_t |
Source pointer (HaDevicePtr). |
size |
size_t |
Number of bytes to copy. |
direction |
int |
Copy direction (numeric HaMemCpyDirection). |
HaMemCpyAsyncParams¶
Args for HaMemCpyAsync.
| Field | Type | Description |
|---|---|---|
dst |
uint64_t |
Destination pointer (HaDevicePtr). |
src |
uint64_t |
Source pointer (HaDevicePtr). |
size |
size_t |
Number of bytes to copy. |
direction |
int |
Copy direction (numeric HaMemCpyDirection). |
stream |
void * |
Stream the copy is enqueued on (HaStream_t). |
HaMemCpyNdParams¶
Args for HaMemCpyNd. The extent is carried as the two HaLayout descriptors rather than a byte count. They are void pointers because HaLayout is C++-only (ha_types.h).
| Field | Type | Description |
|---|---|---|
dst |
uint64_t |
Destination pointer (HaDevicePtr). |
dst_layout |
const void * |
Destination layout (const HaLayout *). |
src |
uint64_t |
Source pointer (HaDevicePtr). |
src_layout |
const void * |
Source layout (const HaLayout *). |
HaMemCpyNdAsyncParams¶
Args for HaMemCpyNdAsync. Mirrors HaMemCpyNdParams.
| Field | Type | Description |
|---|---|---|
dst |
uint64_t |
Destination pointer (HaDevicePtr). |
dst_layout |
const void * |
Destination layout (const HaLayout *). |
src |
uint64_t |
Source pointer (HaDevicePtr). |
src_layout |
const void * |
Source layout (const HaLayout *). |
stream |
void * |
Stream the copy is enqueued on (HaStream_t). |
HaMemLoadFileAsyncParams¶
Args for HaMemLoadFileAsync.
| Field | Type | Description |
|---|---|---|
file_fd |
int |
Source file descriptor. |
file_off |
size_t |
Byte offset within the file. |
dst |
uint64_t |
Destination pointer (HaDevicePtr). |
len |
size_t |
Number of bytes to load. |
stream |
void * |
Stream the load is enqueued on (HaStream_t). |
HaLibraryLoadDataParams¶
Args for HaLibraryLoadData.
| Field | Type | Description |
|---|---|---|
library |
void * |
Where the new library handle (HaLibrary_t) is written. |
data |
const void * |
The library data (a HaLibraryData). |
HaLaunchKernelParams¶
Args for HaLaunchKernel.
| Field | Type | Description |
|---|---|---|
kernel |
void * |
Kernel handle (HaKernel_t) as passed; NULL for the binary-path overload. |
kernel_name |
const char * |
Name of kernel; NULL if kernel is not a valid handle or for a path. |
binary_path |
const char * |
Kernel binary path; NULL for the kernel-handle overload. |
Note
호출한 오버로드에 따라 채워지는 필드가 다릅니다. 아래 값은 런타임이 채워서 콜백에 전달합니다.
- 커널 핸들 오버로드:
kernel(핸들이 유효하면kernel_name도)을 채우며,binary_path는NULL입니다. - 바이너리 경로 오버로드:
binary_path를 채우며,kernel과kernel_name은NULL입니다.
HaLaunchKernelAsyncParams¶
Args for HaLaunchKernelAsync.
| Field | Type | Description |
|---|---|---|
kernel |
void * |
As in HaLaunchKernelParams. |
kernel_name |
const char * |
As in HaLaunchKernelParams. |
binary_path |
const char * |
As in HaLaunchKernelParams. |
stream |
void * |
Stream the launch is enqueued on (HaStream_t). |
HaStreamParams¶
Args for HaStreamSynchronize and HaStreamQuery.
| Field | Type | Description |
|---|---|---|
stream |
void * |
Stream being fenced or polled (HaStream_t; NULL is the caller's default stream). |
HaStreamWaitEventParams¶
Args for HaStreamWaitEvent.
| Field | Type | Description |
|---|---|---|
stream |
void * |
Stream that will wait (HaStream_t). |
event |
void * |
Event waited on (HaEvent_t). |
HaEventRecordParams¶
Args for HaEventRecord.
| Field | Type | Description |
|---|---|---|
event |
void * |
Event being recorded (HaEvent_t). |
stream |
void * |
Stream the record is enqueued on (HaStream_t). |
HaEventParams¶
Args for HaEventSynchronize and HaEventQuery.
| Field | Type | Description |
|---|---|---|
event |
void * |
Event being waited on or polled (HaEvent_t). |