Visible to Intel only — GUID: GUID-C4D1A580-C250-4CE1-86AE-61AB6152872A
Visible to Intel only — GUID: GUID-C4D1A580-C250-4CE1-86AE-61AB6152872A
Memory-Mapped Host Interfaces
Each external memory interface is uniquely identified by a “buffer location” identifier. Buffer location identifiers can be applied to arguments annotated with the mmhost macros or to accessors. A kernel argument with a specified buffer location is sometimes referred to as an annotated pointer argument. An unannotated pointer argument can be any of the of the following items:
Accessor arguments without a specified buffer location
Kernel arguments not annotated with any mmhost macro
For each unique buffer location among the annotated pointer arguments of your kernels, the compile infers one memory-mapped host interface. If you have any unannotated pointer arguments in your kernels, one additional global memory-mapped interface is inferred (with buffer location 0).
You can attribute a buffer location to a kernel argument in the following ways:
Memory-Mapped Host Interfaces Using Unified Shared Memory
USM pointers allow you to customize the memory-mapped host interface.
In most cases, the compiler encodes the virtual address space information automatically. However, in some cases, you might need to encode it yourself. For details, refer to Memory-Mapped Interface Unified-Shared-Memory Virtual Address Space.
Memory-Mapped Host Interfaces Using Accessors
Using accessors allows the runtime and BSP to manage the copying of the memory between the host and device.
Accessor kernel arguments result in four arguments for each accessor argument.
Addresses in Memory-Mapped Host Interfaces
Memory-mapped (MM) host interfaces issue byte addresses, not word addresses.
For example, if you dereference a pointer to a 4-byte wide datatype, the address issued by the MM host interface is base address of the pointer plus the array index multiplied by 4.
Assuming a base address of 0x0000 for mm_a, the following code example results in 0x0018 on the interface because 0x0018 = 0x0006 x 4:
uint32_t value = mm_a[0x0006];
If mm_a has a base address of 0x1000, the resulting address is 0x1018 instead of 0x0018.
If you dereference a pointer to a 1-byte wide datatype, the address issued by the MM Host interface is the base address of the pointer plus the array index multiplied by 1.
Assuming a base address of 0x0000 for mm_a, the following code example results in 0x0006 on the interface because 0x0006 = 0x0006 x 1:
uint8_t value = mm_a[0x0006];
If mm_a has a base address of 0x1000, the resulting address is 0x1006 instead of 0x0006.