rocr: Support different address modes
Support different address modes in X, Y, Z directions
Change-Id: If1db5a8af33c92ddc4b48968c3d8eceb97daea6a
[ROCm/ROCR-Runtime commit: df250a49a5]
Šī revīzija ir iekļauta:
revīziju iesūtīja
David Yat Sin
vecāks
91a28fce54
revīzija
a5de0f048d
@@ -427,6 +427,7 @@ hsa_status_t hsa_system_get_major_extension_table(uint16_t extension, uint16_t v
|
||||
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;
|
||||
ext_table.hsa_ext_sampler_create_v2 = hsa_ext_sampler_create_v2;
|
||||
|
||||
memcpy(table, &ext_table, Min(sizeof(ext_table), table_length));
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ void HsaApiTable::Init() {
|
||||
|
||||
constexpr size_t expected_core_api_table_size = 1016;
|
||||
constexpr size_t expected_amd_ext_table_size = 584;
|
||||
constexpr size_t expected_image_ext_table_size = 120;
|
||||
constexpr size_t expected_image_ext_table_size = 128;
|
||||
constexpr size_t expected_finalizer_ext_table_size = 64;
|
||||
constexpr size_t expected_tools_table_size = 64;
|
||||
constexpr size_t expected_pc_sampling_ext_table_size = 72;
|
||||
|
||||
@@ -425,6 +425,13 @@ hsa_status_t hsa_ext_sampler_create(
|
||||
.hsa_ext_sampler_create_fn(agent, sampler_descriptor, sampler);
|
||||
}
|
||||
|
||||
hsa_status_t hsa_ext_sampler_create_v2(
|
||||
hsa_agent_t agent, const hsa_ext_sampler_descriptor_v2_t* sampler_descriptor,
|
||||
hsa_ext_sampler_t* sampler) {
|
||||
return rocr::core::Runtime::runtime_singleton_->extensions_.image_api
|
||||
.hsa_ext_sampler_create_v2_fn(agent, sampler_descriptor, sampler);
|
||||
}
|
||||
|
||||
hsa_status_t hsa_ext_sampler_destroy(hsa_agent_t agent,
|
||||
hsa_ext_sampler_t sampler) {
|
||||
return rocr::core::Runtime::runtime_singleton_->extensions_.image_api
|
||||
|
||||
@@ -208,6 +208,7 @@ global:
|
||||
hsa_ext_image_clear;
|
||||
hsa_ext_image_destroy;
|
||||
hsa_ext_sampler_create;
|
||||
hsa_ext_sampler_create_v2;
|
||||
hsa_ext_sampler_destroy;
|
||||
hsa_ext_image_get_capability_with_layout;
|
||||
hsa_ext_image_data_get_info_with_layout;
|
||||
|
||||
@@ -261,6 +261,27 @@ hsa_status_t hsa_ext_sampler_create(hsa_agent_t agent,
|
||||
return HSA_STATUS_ERROR_INVALID_AGENT;
|
||||
}
|
||||
|
||||
if (sampler_descriptor == NULL || sampler == NULL) {
|
||||
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
hsa_ext_sampler_descriptor_v2_t sampler_descriptor_v2 = {
|
||||
sampler_descriptor->coordinate_mode,
|
||||
sampler_descriptor->filter_mode,
|
||||
{sampler_descriptor->address_mode,
|
||||
sampler_descriptor->address_mode, sampler_descriptor->address_mode}
|
||||
};
|
||||
return ImageRuntime::instance()->CreateSamplerHandle(agent, sampler_descriptor_v2, *sampler);
|
||||
CATCH;
|
||||
}
|
||||
|
||||
hsa_status_t hsa_ext_sampler_create_v2(hsa_agent_t agent,
|
||||
const hsa_ext_sampler_descriptor_v2_t* sampler_descriptor,
|
||||
hsa_ext_sampler_t* sampler) {
|
||||
TRY;
|
||||
if (agent.handle == 0) {
|
||||
return HSA_STATUS_ERROR_INVALID_AGENT;
|
||||
}
|
||||
|
||||
if (sampler_descriptor == NULL || sampler == NULL) {
|
||||
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
@@ -397,6 +418,8 @@ void LoadImage(core::ImageExtTableInternal* image_api,
|
||||
|
||||
image_api->hsa_amd_image_get_info_max_dim_fn = hsa_amd_image_get_info_max_dim;
|
||||
|
||||
image_api->hsa_ext_sampler_create_v2_fn = hsa_ext_sampler_create_v2;
|
||||
|
||||
*interface_api = hsa_amd_image_create;
|
||||
}
|
||||
|
||||
|
||||
@@ -134,6 +134,34 @@ class ImageManager {
|
||||
static void FormatPattern(const hsa_ext_image_format_t& format,
|
||||
const void* pattern_in, void* pattern_out);
|
||||
|
||||
template <typename dstT, typename srcT>
|
||||
static inline hsa_status_t convertAddressMode(dstT &word,
|
||||
const hsa_ext_sampler_addressing_mode32_t address_mode[3]) {
|
||||
srcT clamp[3];
|
||||
for (int i = 0; i < 3; i++) {
|
||||
switch (address_mode[i]) {
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE:
|
||||
clamp[i] = srcT::SQ_TEX_CLAMP_LAST_TEXEL;
|
||||
break;
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_CLAMP_TO_BORDER:
|
||||
clamp[i] = srcT::SQ_TEX_CLAMP_BORDER;
|
||||
break;
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT:
|
||||
clamp[i] = srcT::SQ_TEX_MIRROR;
|
||||
break;
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_UNDEFINED:
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_REPEAT:
|
||||
clamp[i] = srcT::SQ_TEX_WRAP;
|
||||
break;
|
||||
default:
|
||||
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
}
|
||||
word.bits.CLAMP_X = static_cast<unsigned int>(clamp[0]);
|
||||
word.bits.CLAMP_Y = static_cast<unsigned int>(clamp[1]);
|
||||
word.bits.CLAMP_Z = static_cast<unsigned int>(clamp[2]);
|
||||
return HSA_STATUS_SUCCESS;
|
||||
}
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ImageManager);
|
||||
};
|
||||
|
||||
@@ -452,7 +452,7 @@ hsa_status_t ImageManagerAi::ModifyImageSrd(
|
||||
}
|
||||
|
||||
hsa_status_t ImageManagerAi::PopulateSamplerSrd(Sampler& sampler) const {
|
||||
const hsa_ext_sampler_descriptor_t sampler_descriptor = sampler.desc;
|
||||
const hsa_ext_sampler_descriptor_v2_t &sampler_descriptor = sampler.desc;
|
||||
|
||||
SQ_IMG_SAMP_WORD0 word0;
|
||||
SQ_IMG_SAMP_WORD1 word1;
|
||||
@@ -460,25 +460,9 @@ hsa_status_t ImageManagerAi::PopulateSamplerSrd(Sampler& sampler) const {
|
||||
SQ_IMG_SAMP_WORD3 word3;
|
||||
|
||||
word0.u32All = 0;
|
||||
switch (sampler_descriptor.address_mode) {
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE:
|
||||
word0.bits.CLAMP_X = static_cast<int>(SQ_TEX_CLAMP_LAST_TEXEL);
|
||||
break;
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_CLAMP_TO_BORDER:
|
||||
word0.bits.CLAMP_X = static_cast<int>(SQ_TEX_CLAMP_BORDER);
|
||||
break;
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT:
|
||||
word0.bits.CLAMP_X = static_cast<int>(SQ_TEX_MIRROR);
|
||||
break;
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_UNDEFINED:
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_REPEAT:
|
||||
word0.bits.CLAMP_X = static_cast<int>(SQ_TEX_WRAP);
|
||||
break;
|
||||
default:
|
||||
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
word0.bits.CLAMP_Y = word0.bits.CLAMP_X;
|
||||
word0.bits.CLAMP_Z = word0.bits.CLAMP_X;
|
||||
hsa_status_t status = convertAddressMode<SQ_IMG_SAMP_WORD0, SQ_TEX_CLAMP>
|
||||
(word0, sampler_descriptor.address_modes);
|
||||
if (status != HSA_STATUS_SUCCESS) return status;
|
||||
word0.bits.FORCE_UNNORMALIZED = (sampler_descriptor.coordinate_mode ==
|
||||
HSA_EXT_SAMPLER_COORDINATE_MODE_UNNORMALIZED);
|
||||
|
||||
|
||||
@@ -572,7 +572,7 @@ hsa_status_t ImageManagerGfx11::ModifyImageSrd(
|
||||
}
|
||||
|
||||
hsa_status_t ImageManagerGfx11::PopulateSamplerSrd(Sampler& sampler) const {
|
||||
const hsa_ext_sampler_descriptor_t sampler_descriptor = sampler.desc;
|
||||
const hsa_ext_sampler_descriptor_v2_t &sampler_descriptor = sampler.desc;
|
||||
|
||||
SQ_IMG_SAMP_WORD0 word0;
|
||||
SQ_IMG_SAMP_WORD1 word1;
|
||||
@@ -580,25 +580,9 @@ hsa_status_t ImageManagerGfx11::PopulateSamplerSrd(Sampler& sampler) const {
|
||||
SQ_IMG_SAMP_WORD3 word3;
|
||||
|
||||
word0.u32All = 0;
|
||||
switch (sampler_descriptor.address_mode) {
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE:
|
||||
word0.bits.CLAMP_X = static_cast<int>(SQ_TEX_CLAMP_LAST_TEXEL);
|
||||
break;
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_CLAMP_TO_BORDER:
|
||||
word0.bits.CLAMP_X = static_cast<int>(SQ_TEX_CLAMP_BORDER);
|
||||
break;
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT:
|
||||
word0.bits.CLAMP_X = static_cast<int>(SQ_TEX_MIRROR);
|
||||
break;
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_UNDEFINED:
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_REPEAT:
|
||||
word0.bits.CLAMP_X = static_cast<int>(SQ_TEX_WRAP);
|
||||
break;
|
||||
default:
|
||||
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
word0.bits.CLAMP_Y = word0.bits.CLAMP_X;
|
||||
word0.bits.CLAMP_Z = word0.bits.CLAMP_X;
|
||||
hsa_status_t status = convertAddressMode<SQ_IMG_SAMP_WORD0, SQ_TEX_CLAMP>
|
||||
(word0, sampler_descriptor.address_modes);
|
||||
if (status != HSA_STATUS_SUCCESS) return status;
|
||||
word0.bits.FORCE_UNNORMALIZED = (sampler_descriptor.coordinate_mode ==
|
||||
HSA_EXT_SAMPLER_COORDINATE_MODE_UNNORMALIZED);
|
||||
|
||||
|
||||
@@ -595,7 +595,7 @@ hsa_status_t ImageManagerGfx12::ModifyImageSrd(
|
||||
}
|
||||
|
||||
hsa_status_t ImageManagerGfx12::PopulateSamplerSrd(Sampler& sampler) const {
|
||||
const hsa_ext_sampler_descriptor_t sampler_descriptor = sampler.desc;
|
||||
const hsa_ext_sampler_descriptor_v2_t &sampler_descriptor = sampler.desc;
|
||||
|
||||
SQ_IMG_SAMP_WORD0 word0;
|
||||
SQ_IMG_SAMP_WORD1 word1;
|
||||
@@ -603,25 +603,9 @@ hsa_status_t ImageManagerGfx12::PopulateSamplerSrd(Sampler& sampler) const {
|
||||
SQ_IMG_SAMP_WORD3 word3;
|
||||
|
||||
word0.u32All = 0;
|
||||
switch (sampler_descriptor.address_mode) {
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE:
|
||||
word0.bits.CLAMP_X = static_cast<int>(SQ_TEX_CLAMP_LAST_TEXEL);
|
||||
break;
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_CLAMP_TO_BORDER:
|
||||
word0.bits.CLAMP_X = static_cast<int>(SQ_TEX_CLAMP_BORDER);
|
||||
break;
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT:
|
||||
word0.bits.CLAMP_X = static_cast<int>(SQ_TEX_MIRROR);
|
||||
break;
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_UNDEFINED:
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_REPEAT:
|
||||
word0.bits.CLAMP_X = static_cast<int>(SQ_TEX_WRAP);
|
||||
break;
|
||||
default:
|
||||
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
word0.bits.CLAMP_Y = word0.bits.CLAMP_X;
|
||||
word0.bits.CLAMP_Z = word0.bits.CLAMP_X;
|
||||
hsa_status_t status = convertAddressMode<SQ_IMG_SAMP_WORD0, SQ_TEX_CLAMP>
|
||||
(word0, sampler_descriptor.address_modes);
|
||||
if (status != HSA_STATUS_SUCCESS) return status;
|
||||
word0.bits.FORCE_UNNORMALIZED = (sampler_descriptor.coordinate_mode ==
|
||||
HSA_EXT_SAMPLER_COORDINATE_MODE_UNNORMALIZED);
|
||||
|
||||
|
||||
@@ -518,7 +518,7 @@ hsa_status_t ImageManagerKv::ModifyImageSrd(
|
||||
}
|
||||
|
||||
hsa_status_t ImageManagerKv::PopulateSamplerSrd(Sampler& sampler) const {
|
||||
const hsa_ext_sampler_descriptor_t sampler_descriptor = sampler.desc;
|
||||
const hsa_ext_sampler_descriptor_v2_t &sampler_descriptor = sampler.desc;
|
||||
|
||||
SQ_IMG_SAMP_WORD0 word0;
|
||||
SQ_IMG_SAMP_WORD1 word1;
|
||||
@@ -526,25 +526,9 @@ hsa_status_t ImageManagerKv::PopulateSamplerSrd(Sampler& sampler) const {
|
||||
SQ_IMG_SAMP_WORD3 word3;
|
||||
|
||||
word0.u32_all = 0;
|
||||
switch (sampler_descriptor.address_mode) {
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE:
|
||||
word0.bits.clamp_x = static_cast<int>(SQ_TEX_CLAMP_LAST_TEXEL);
|
||||
break;
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_CLAMP_TO_BORDER:
|
||||
word0.bits.clamp_x = static_cast<int>(SQ_TEX_CLAMP_BORDER);
|
||||
break;
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT:
|
||||
word0.bits.clamp_x = static_cast<int>(SQ_TEX_MIRROR);
|
||||
break;
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_UNDEFINED:
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_REPEAT:
|
||||
word0.bits.clamp_x = static_cast<int>(SQ_TEX_WRAP);
|
||||
break;
|
||||
default:
|
||||
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
word0.bits.clamp_y = word0.bits.clamp_x;
|
||||
word0.bits.clamp_z = word0.bits.clamp_x;
|
||||
hsa_status_t status = convertAddressMode<SQ_IMG_SAMP_WORD0, SQ_TEX_CLAMP>
|
||||
(word0, sampler_descriptor.address_modes);
|
||||
if (status != HSA_STATUS_SUCCESS) return status;
|
||||
word0.bits.force_unormalized = (sampler_descriptor.coordinate_mode ==
|
||||
HSA_EXT_SAMPLER_COORDINATE_MODE_UNNORMALIZED);
|
||||
|
||||
|
||||
@@ -565,7 +565,7 @@ hsa_status_t ImageManagerNv::ModifyImageSrd(
|
||||
}
|
||||
|
||||
hsa_status_t ImageManagerNv::PopulateSamplerSrd(Sampler& sampler) const {
|
||||
const hsa_ext_sampler_descriptor_t sampler_descriptor = sampler.desc;
|
||||
const hsa_ext_sampler_descriptor_v2_t &sampler_descriptor = sampler.desc;
|
||||
|
||||
SQ_IMG_SAMP_WORD0 word0;
|
||||
SQ_IMG_SAMP_WORD1 word1;
|
||||
@@ -573,25 +573,9 @@ hsa_status_t ImageManagerNv::PopulateSamplerSrd(Sampler& sampler) const {
|
||||
SQ_IMG_SAMP_WORD3 word3;
|
||||
|
||||
word0.u32All = 0;
|
||||
switch (sampler_descriptor.address_mode) {
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE:
|
||||
word0.bits.CLAMP_X = static_cast<int>(SQ_TEX_CLAMP_LAST_TEXEL);
|
||||
break;
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_CLAMP_TO_BORDER:
|
||||
word0.bits.CLAMP_X = static_cast<int>(SQ_TEX_CLAMP_BORDER);
|
||||
break;
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT:
|
||||
word0.bits.CLAMP_X = static_cast<int>(SQ_TEX_MIRROR);
|
||||
break;
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_UNDEFINED:
|
||||
case HSA_EXT_SAMPLER_ADDRESSING_MODE_REPEAT:
|
||||
word0.bits.CLAMP_X = static_cast<int>(SQ_TEX_WRAP);
|
||||
break;
|
||||
default:
|
||||
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
word0.bits.CLAMP_Y = word0.bits.CLAMP_X;
|
||||
word0.bits.CLAMP_Z = word0.bits.CLAMP_X;
|
||||
hsa_status_t status = convertAddressMode<SQ_IMG_SAMP_WORD0, SQ_TEX_CLAMP>
|
||||
(word0, sampler_descriptor.address_modes);
|
||||
if (status != HSA_STATUS_SUCCESS) return status;
|
||||
word0.bits.FORCE_UNNORMALIZED = (sampler_descriptor.coordinate_mode ==
|
||||
HSA_EXT_SAMPLER_COORDINATE_MODE_UNNORMALIZED);
|
||||
|
||||
|
||||
@@ -533,7 +533,7 @@ hsa_status_t ImageRuntime::FillImage(
|
||||
|
||||
hsa_status_t ImageRuntime::CreateSamplerHandle(
|
||||
hsa_agent_t component,
|
||||
const hsa_ext_sampler_descriptor_t& sampler_descriptor,
|
||||
const hsa_ext_sampler_descriptor_v2_t& sampler_descriptor,
|
||||
hsa_ext_sampler_t& sampler_handle) {
|
||||
sampler_handle.handle = 0;
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ class ImageRuntime {
|
||||
/// @brief Create device sampler object and return its handle.
|
||||
hsa_status_t CreateSamplerHandle(
|
||||
hsa_agent_t component,
|
||||
const hsa_ext_sampler_descriptor_t& sampler_descriptor,
|
||||
const hsa_ext_sampler_descriptor_v2_t& sampler_descriptor,
|
||||
hsa_ext_sampler_t& sampler);
|
||||
|
||||
/// @brief Destroy the device sampler object referenced by the handle.
|
||||
|
||||
@@ -94,6 +94,10 @@ hsa_status_t hsa_ext_sampler_create(hsa_agent_t agent,
|
||||
const hsa_ext_sampler_descriptor_t* sampler_descriptor,
|
||||
hsa_ext_sampler_t* sampler);
|
||||
|
||||
hsa_status_t hsa_ext_sampler_create_v2(hsa_agent_t agent,
|
||||
const hsa_ext_sampler_descriptor_v2_t* sampler_descriptor,
|
||||
hsa_ext_sampler_t* sampler);
|
||||
|
||||
hsa_status_t hsa_ext_sampler_destroy(hsa_agent_t agent, hsa_ext_sampler_t sampler);
|
||||
|
||||
hsa_status_t hsa_ext_image_get_capability_with_layout(hsa_agent_t agent,
|
||||
|
||||
@@ -199,7 +199,7 @@ public:
|
||||
hsa_agent_t component;
|
||||
|
||||
// HSA sampler descriptor of the image object.
|
||||
hsa_ext_sampler_descriptor_t desc;
|
||||
hsa_ext_sampler_descriptor_v2_t desc;
|
||||
} Sampler;
|
||||
|
||||
} // namespace image
|
||||
|
||||
@@ -299,9 +299,9 @@ union SQ_IMG_RSRC_WORD7 {
|
||||
union SQ_IMG_SAMP_WORD0 {
|
||||
struct {
|
||||
#if defined(LITTLEENDIAN_CPU)
|
||||
unsigned int clamp_x : 3;
|
||||
unsigned int clamp_y : 3;
|
||||
unsigned int clamp_z : 3;
|
||||
unsigned int CLAMP_X : 3;
|
||||
unsigned int CLAMP_Y : 3;
|
||||
unsigned int CLAMP_Z : 3;
|
||||
unsigned int max_aniso_ratio : 3;
|
||||
unsigned int depth_compare_func : 3;
|
||||
unsigned int force_unormalized : 1;
|
||||
@@ -325,9 +325,9 @@ union SQ_IMG_SAMP_WORD0 {
|
||||
unsigned int force_unormalized : 1;
|
||||
unsigned int depth_compare_func : 3;
|
||||
unsigned int max_aniso_ratio : 3;
|
||||
unsigned int clamp_z : 3;
|
||||
unsigned int clamp_y : 3;
|
||||
unsigned int clamp_x : 3;
|
||||
unsigned int CLAMP_Z : 3;
|
||||
unsigned int CLAMP_Y : 3;
|
||||
unsigned int CLAMP_X : 3;
|
||||
#endif
|
||||
} bitfields, bits;
|
||||
unsigned int u32_all;
|
||||
|
||||
@@ -176,6 +176,8 @@ struct ImageExtTable {
|
||||
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;
|
||||
decltype(hsa_ext_sampler_create_v2)* hsa_ext_sampler_create_v2_fn;
|
||||
|
||||
};
|
||||
|
||||
// Table to export HSA PC Sampling Extension Apis
|
||||
|
||||
@@ -60,7 +60,9 @@
|
||||
#define HSA_CORE_API_TABLE_STEP_VERSION 0x00
|
||||
#define HSA_AMD_EXT_API_TABLE_STEP_VERSION 0x04
|
||||
#define HSA_FINALIZER_API_TABLE_STEP_VERSION 0x00
|
||||
#define HSA_IMAGE_API_TABLE_STEP_VERSION 0x00
|
||||
#define HSA_IMAGE_API_TABLE_STEP_VERSION 0x01
|
||||
// Rocprofiler just checks HSA_MAGE_EXT_API_TABLE_STEP_VERSION
|
||||
#define HSA_IMAGE_EXT_API_TABLE_STEP_VERSION HSA_IMAGE_API_TABLE_STEP_VERSION
|
||||
#define HSA_AQLPROFILE_API_TABLE_STEP_VERSION 0x00
|
||||
#define HSA_TOOLS_API_TABLE_STEP_VERSION 0x00
|
||||
#define HSA_PC_SAMPLING_API_TABLE_STEP_VERSION 0x00
|
||||
|
||||
@@ -1090,8 +1090,8 @@ hsa_status_t HSA_API hsa_ext_image_clear(
|
||||
|
||||
/**
|
||||
* @brief Sampler handle. Samplers are populated by
|
||||
* ::hsa_ext_sampler_create. Sampler handles are only unique within an
|
||||
* agent, not across agents.
|
||||
* ::hsa_ext_sampler_create or ::hsa_ext_sampler_create_v2. Sampler handles are only unique
|
||||
* within an agent, not across agents.
|
||||
*/
|
||||
typedef struct hsa_ext_sampler_s {
|
||||
/**
|
||||
@@ -1218,9 +1218,30 @@ typedef struct hsa_ext_sampler_descriptor_s {
|
||||
* coordinates.
|
||||
*/
|
||||
hsa_ext_sampler_addressing_mode32_t address_mode;
|
||||
|
||||
} hsa_ext_sampler_descriptor_t;
|
||||
|
||||
/**
|
||||
* @brief Implementation independent sampler descriptor v2 which supports
|
||||
* different address modes in X, Y and Z axises.
|
||||
*/
|
||||
typedef struct hsa_ext_sampler_descriptor_v2_s {
|
||||
/**
|
||||
* Sampler coordinate mode describes the normalization of image coordinates.
|
||||
*/
|
||||
hsa_ext_sampler_coordinate_mode32_t coordinate_mode;
|
||||
|
||||
/**
|
||||
* Sampler filter type describes the type of sampling performed.
|
||||
*/
|
||||
hsa_ext_sampler_filter_mode32_t filter_mode;
|
||||
|
||||
/**
|
||||
* Sampler address mode describes the processing of out-of-range image
|
||||
* coordinates.
|
||||
*/
|
||||
hsa_ext_sampler_addressing_mode32_t address_modes[3]; // in X, Y and Z axises
|
||||
} hsa_ext_sampler_descriptor_v2_t;
|
||||
|
||||
/**
|
||||
* @brief Create an agent specific sampler handle for a given agent
|
||||
* independent sampler descriptor and agent.
|
||||
@@ -1256,7 +1277,42 @@ hsa_status_t HSA_API hsa_ext_sampler_create(
|
||||
hsa_ext_sampler_t *sampler);
|
||||
|
||||
/**
|
||||
* @brief Destroy a sampler handle previously created using ::hsa_ext_sampler_create.
|
||||
* @brief Create an agent specific sampler handle for a given agent
|
||||
* independent sampler descriptor v2 and agent.
|
||||
*
|
||||
* @param[in] agent Agent to be associated with the sampler handle created.
|
||||
*
|
||||
* @param[in] sampler_descriptor v2 Pointer to a sampler descriptor. Must not be
|
||||
* NULL.
|
||||
*
|
||||
* @param[out] sampler Memory location where the HSA runtime stores the newly
|
||||
* created sampler handle. Must not be NULL.
|
||||
*
|
||||
* @retval ::HSA_STATUS_SUCCESS The function has been executed successfully.
|
||||
*
|
||||
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been
|
||||
* initialized.
|
||||
*
|
||||
* @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid.
|
||||
*
|
||||
* @retval ::HSA_EXT_STATUS_ERROR_SAMPLER_DESCRIPTOR_UNSUPPORTED The
|
||||
* @p agent does not have the capability to support the properties
|
||||
* specified by @p sampler_descriptor or it is invalid.
|
||||
*
|
||||
* @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to allocate
|
||||
* the required resources.
|
||||
*
|
||||
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p sampler_descriptor is NULL, or
|
||||
* @p sampler is NULL.
|
||||
*/
|
||||
hsa_status_t HSA_API hsa_ext_sampler_create_v2(
|
||||
hsa_agent_t agent,
|
||||
const hsa_ext_sampler_descriptor_v2_t *sampler_descriptor,
|
||||
hsa_ext_sampler_t *sampler);
|
||||
|
||||
/**
|
||||
* @brief Destroy a sampler handle previously created using ::hsa_ext_sampler_create or
|
||||
* ::hsa_ext_sampler_create_v2.
|
||||
*
|
||||
* @details The sampler handle should not be destroyed while there are
|
||||
* references to it queued for execution or currently being used in a
|
||||
@@ -1444,6 +1500,11 @@ typedef struct hsa_ext_images_1_pfn_s {
|
||||
size_t image_data_slice_pitch,
|
||||
hsa_ext_image_t *image);
|
||||
|
||||
hsa_status_t (*hsa_ext_sampler_create_v2)(
|
||||
hsa_agent_t agent,
|
||||
const hsa_ext_sampler_descriptor_v2_t *sampler_descriptor,
|
||||
hsa_ext_sampler_t *sampler);
|
||||
|
||||
} hsa_ext_images_1_pfn_t;
|
||||
/** @} */
|
||||
|
||||
|
||||
Atsaukties uz šo jaunā problēmā
Block a user