Dear developers,
My environment: Ubuntu 14.04 + Linux 4.0.0-100002-generic + HSA runtime 1.0.3 on Kaveri.
I want to allocate some __constant memory on the host side for my OpenCL kernel argument, and I modify the running example to make use of HSA runtime API.
typedef struct HsaContext
{
hsa_agent_t agent;
hsa_queue_t* queue;
uint32_t queue_max_size;
hsa_code_object_t code_object;
hsa_executable_t executable;
hsa_executable_symbol_t symbol;
GPUInformation info;
} HsaContext;
static hsa_status_t get_readonly_memory_region(hsa_region_t region, void* data)
{
hsa_region_segment_t segment;
hsa_status_t e;
e = hsa_region_get_info(region, HSA_REGION_INFO_SEGMENT, &segment);
check(Query Region Segment Info, e);
if (HSA_REGION_SEGMENT_READONLY != segment) {
printf("segment enum: %d\n", segment);
return HSA_STATUS_SUCCESS;
}
printf("Success, and segment enum is : %d\n", segment);
*((hsa_region_t*)data) = region;
return HSA_STATUS_INFO_BREAK;
}
// Implement the helper function inspired by the other two similar functions
hsa_region_t FindReadonlyRegion(HsaContext* ctx)
{
hsa_region_t ret;
ret.handle=(uint64_t)-1;
hsa_agent_iterate_regions(ctx->agent, get_readonly_memory_region, &ret);
hsa_status_t e;
e = (ret.handle == (uint64_t)-1) ? HSA_STATUS_ERROR : HSA_STATUS_SUCCESS;
check(Finding a readonly memory region, e);
return ret;
}
And the runtime print three segment enum (3 0 0 in order), and none of which is 1 (HSA_REGION_SEGMENT_READONLY).
Does it imply that currently the HSA runtime has no such segment, or the code is wrong? Thanks.
Dear developers, My environment: Ubuntu 14.04 + Linux 4.0.0-100002-generic + HSA runtime 1.0.3 on Kaveri.
I want to allocate some __constant memory on the host side for my OpenCL kernel argument, and I modify the running example to make use of HSA runtime API.
And the runtime print three segment enum (3 0 0 in order), and none of which is 1 (
HSA_REGION_SEGMENT_READONLY
).Does it imply that currently the HSA runtime has no such segment, or the code is wrong? Thanks.