Add new 1.1 image APIs

Note: Implementation same as 1.0 APIs for now.
      The followup change will have the complete implementation.

Change-Id: Ife633f74ff27eee0bb9b0c46952cf5233b0114e8


[ROCm/ROCR-Runtime commit: a324f21a46]
Tento commit je obsažen v:
Christophe Paquot
2017-01-18 16:39:34 -08:00
rodič 0bb7f56486
revize 4bb9fb4469
4 změnil soubory, kde provedl 76 přidání a 1 odebrání
+4 -1
Zobrazit soubor
@@ -358,7 +358,7 @@ hsa_status_t hsa_system_get_major_extension_table(uint16_t extension, uint16_t v
if (extension == HSA_EXTENSION_IMAGES) {
if (version_major > 1) return HSA_STATUS_ERROR;
hsa_ext_images_1_00_pfn_t ext_table;
hsa_ext_images_1_pfn_t ext_table;
ext_table.hsa_ext_image_clear = hsa_ext_image_clear;
ext_table.hsa_ext_image_copy = hsa_ext_image_copy;
ext_table.hsa_ext_image_create = hsa_ext_image_create;
@@ -369,6 +369,9 @@ hsa_status_t hsa_system_get_major_extension_table(uint16_t extension, uint16_t v
ext_table.hsa_ext_image_import = hsa_ext_image_import;
ext_table.hsa_ext_sampler_create = hsa_ext_sampler_create;
ext_table.hsa_ext_sampler_destroy = hsa_ext_sampler_destroy;
ext_table.hsa_ext_image_get_capability_with_layout = hsa_ext_image_get_capability_with_layout;
ext_table.hsa_ext_image_data_get_info_with_layout = hsa_ext_image_data_get_info_with_layout;
ext_table.hsa_ext_image_create_with_layout = hsa_ext_image_create_with_layout;
memcpy(table, &ext_table, Min(sizeof(ext_table), table_length));
@@ -207,6 +207,9 @@ void ExtensionEntryPoints::InitImageExtTable() {
image_api.hsa_ext_sampler_create_fn = hsa_ext_null;
image_api.hsa_ext_sampler_destroy_fn = hsa_ext_null;
image_api.hsa_amd_image_get_info_max_dim_fn = hsa_ext_null;
image_api.hsa_ext_image_get_capability_with_layout_fn = hsa_ext_null;
image_api.hsa_ext_image_data_get_info_with_layout_fn = hsa_ext_null;
image_api.hsa_ext_image_create_with_layout_fn = hsa_ext_null;
}
// Initialize Amd Ext table for Api related to Images
@@ -346,6 +349,32 @@ bool ExtensionEntryPoints::LoadImage(std::string library_name) {
(decltype(::hsa_ext_sampler_destroy)*)ptr;
}
ptr = os::GetExportAddress(lib, "hsa_ext_image_get_capability_with_layout_impl");
if (ptr != NULL) {
assert(image_api.hsa_ext_image_get_capability_with_layout_fn ==
(decltype(::hsa_ext_image_get_capability_with_layout)*)hsa_ext_null &&
"Duplicate load of extension import.");
image_api.hsa_ext_image_get_capability_with_layout_fn =
(decltype(::hsa_ext_image_get_capability_with_layout)*)ptr;
}
ptr = os::GetExportAddress(lib, "hsa_ext_image_data_get_info_with_layout_impl");
if (ptr != NULL) {
assert(image_api.hsa_ext_image_data_get_info_with_layout_fn ==
(decltype(::hsa_ext_image_data_get_info_with_layout)*)hsa_ext_null &&
"Duplicate load of extension import.");
image_api.hsa_ext_image_data_get_info_with_layout_fn =
(decltype(::hsa_ext_image_data_get_info_with_layout)*)ptr;
}
ptr = os::GetExportAddress(lib, "hsa_ext_image_create_with_layout_impl");
if (ptr != NULL) {
assert(image_api.hsa_ext_image_create_with_layout_fn ==
(decltype(::hsa_ext_image_create_with_layout)*)hsa_ext_null &&
"Duplicate load of extension import.");
image_api.hsa_ext_image_create_with_layout_fn = (decltype(::hsa_ext_image_create_with_layout)*)ptr;
}
ptr = os::GetExportAddress(lib, "hsa_amd_image_get_info_max_dim_impl");
if (ptr != NULL) {
assert(image_api.hsa_amd_image_get_info_max_dim_fn ==
@@ -588,6 +617,44 @@ hsa_status_t hsa_ext_sampler_destroy(hsa_agent_t agent,
.hsa_ext_sampler_destroy_fn(agent, sampler);
}
hsa_status_t hsa_ext_image_get_capability_with_layout(
hsa_agent_t agent, hsa_ext_image_geometry_t geometry,
const hsa_ext_image_format_t* image_format,
hsa_ext_image_data_layout_t image_data_layout,
uint32_t* capability_mask) {
return core::Runtime::runtime_singleton_->extensions_.image_api
.hsa_ext_image_get_capability_with_layout_fn(agent, geometry, image_format,
image_data_layout, capability_mask);
}
hsa_status_t hsa_ext_image_data_get_info_with_layout(
hsa_agent_t agent, const hsa_ext_image_descriptor_t* image_descriptor,
hsa_access_permission_t access_permission,
hsa_ext_image_data_layout_t image_data_layout,
size_t image_data_row_pitch,
size_t image_data_slice_pitch,
hsa_ext_image_data_info_t* image_data_info) {
return core::Runtime::runtime_singleton_->extensions_.image_api
.hsa_ext_image_data_get_info_with_layout_fn(agent, image_descriptor,
access_permission, image_data_layout,
image_data_row_pitch, image_data_slice_pitch,
image_data_info);
}
hsa_status_t hsa_ext_image_create_with_layout(
hsa_agent_t agent, const hsa_ext_image_descriptor_t* image_descriptor,
const void* image_data, hsa_access_permission_t access_permission,
hsa_ext_image_data_layout_t image_data_layout,
size_t image_data_row_pitch,
size_t image_data_slice_pitch,
hsa_ext_image_t* image) {
return core::Runtime::runtime_singleton_->extensions_.image_api
.hsa_ext_image_create_with_layout_fn(agent, image_descriptor, image_data,
access_permission, image_data_layout,
image_data_row_pitch, image_data_slice_pitch,
image);
}
//---------------------------------------------------------------------------//
// Stubs for internal extension functions
//---------------------------------------------------------------------------//
+3
Zobrazit soubor
@@ -109,6 +109,9 @@ struct ImageExtTable {
decltype(hsa_ext_image_destroy)* hsa_ext_image_destroy_fn;
decltype(hsa_ext_sampler_create)* hsa_ext_sampler_create_fn;
decltype(hsa_ext_sampler_destroy)* hsa_ext_sampler_destroy_fn;
decltype(hsa_ext_image_get_capability_with_layout)* hsa_ext_image_get_capability_with_layout_fn;
decltype(hsa_ext_image_data_get_info_with_layout)* hsa_ext_image_data_get_info_with_layout_fn;
decltype(hsa_ext_image_create_with_layout)* hsa_ext_image_create_with_layout_fn;
};
// Table to export AMD Extension Apis
+2
Zobrazit soubor
@@ -655,6 +655,7 @@ hsa_status_t HSA_API hsa_ext_image_data_get_info(
* or @p image_data_info is NULL.
*/
hsa_status_t HSA_API hsa_ext_image_data_get_info_with_layout(
hsa_agent_t agent,
const hsa_ext_image_descriptor_t *image_descriptor,
hsa_access_permission_t access_permission,
hsa_ext_image_data_layout_t image_data_layout,
@@ -1425,6 +1426,7 @@ typedef struct hsa_ext_images_1_pfn_s {
uint32_t *capability_mask);
hsa_status_t (*hsa_ext_image_data_get_info_with_layout)(
hsa_agent_t agent,
const hsa_ext_image_descriptor_t *image_descriptor,
hsa_access_permission_t access_permission,
hsa_ext_image_data_layout_t image_data_layout,