diff --git a/shared/source/device_binary_format/zebin/zeinfo.h b/shared/source/device_binary_format/zebin/zeinfo.h index 721741f663..f8b49073de 100644 --- a/shared/source/device_binary_format/zebin/zeinfo.h +++ b/shared/source/device_binary_format/zebin/zeinfo.h @@ -407,17 +407,9 @@ inline constexpr ConstStringRef required[] = { Tags::Kernel::ExecutionEnv::simdSize}; struct ExecutionEnvExt; -ExecutionEnvExt *allocateExecEnvExt(); -void freeExecEnvExt(ExecutionEnvExt *); struct ExecutionEnvBaseT final : NEO::NonCopyableAndNonMovableClass { - ExecutionEnvBaseT() { - execEnvExt = allocateExecEnvExt(); - } - ~ExecutionEnvBaseT() { - freeExecEnvExt(execEnvExt); - } - ExecutionEnvExt *execEnvExt = nullptr; + Ext execEnvExt; BarrierCountT barrierCount = Defaults::barrierCount; DisableMidThreadPreemptionT disableMidThreadPreemption = Defaults::disableMidThreadPreemption; diff --git a/shared/source/device_binary_format/zebin/zeinfo_decoder.h b/shared/source/device_binary_format/zebin/zeinfo_decoder.h index ac512413e7..85e18469c9 100644 --- a/shared/source/device_binary_format/zebin/zeinfo_decoder.h +++ b/shared/source/device_binary_format/zebin/zeinfo_decoder.h @@ -22,7 +22,6 @@ namespace Zebin::ZeInfo { inline constexpr NEO::Zebin::ZeInfo::Types::Version zeInfoDecoderVersion{1, 54}; using KernelExecutionEnvBaseT = Types::Kernel::ExecutionEnv::ExecutionEnvBaseT; -using KernelPayloadArgBaseT = Types::Kernel::PayloadArgument::PayloadArgumentBaseT; template bool readZeInfoValueChecked(const NEO::Yaml::YamlParser &parser, const NEO::Yaml::Node &node, T &outValue, ConstStringRef context, std::string &outErrReason); diff --git a/shared/source/device_binary_format/zebin/zeinfo_decoder_ext.cpp b/shared/source/device_binary_format/zebin/zeinfo_decoder_ext.cpp index 57a454fabd..17b2677071 100644 --- a/shared/source/device_binary_format/zebin/zeinfo_decoder_ext.cpp +++ b/shared/source/device_binary_format/zebin/zeinfo_decoder_ext.cpp @@ -21,14 +21,6 @@ bool readZeInfoArgTypeNameCheckedExt(const NEO::Yaml::YamlParser &parser, const return false; } -namespace Types::Kernel::ExecutionEnv { -ExecutionEnvExt *allocateExecEnvExt() { - return nullptr; -} -void freeExecEnvExt(ExecutionEnvExt *envExt) { -} -} // namespace Types::Kernel::ExecutionEnv - void populateKernelExecutionEnvironmentExt(KernelDescriptor &dst, const KernelExecutionEnvBaseT &execEnv, const Types::Version &srcZeInfoVersion) { } @@ -45,3 +37,15 @@ void cloneExt(ExtUniquePtrT void destroyExt(NEO::Zebin::ZeInfo::Types::Kernel::PayloadArgument::PayloadArgumentExtT *dst) { } + +template <> +void cloneExt(ExtUniquePtrT &dst, const NEO::Zebin::ZeInfo::Types::Kernel::ExecutionEnv::ExecutionEnvExt &src) { +} + +template <> +void destroyExt(NEO::Zebin::ZeInfo::Types::Kernel::ExecutionEnv::ExecutionEnvExt *dst) { +} + +template <> +void allocateExt(ExtUniquePtrT &dst) { +} diff --git a/shared/source/utilities/mem_lifetime.h b/shared/source/utilities/mem_lifetime.h index e0e5717837..f10d7acb23 100644 --- a/shared/source/utilities/mem_lifetime.h +++ b/shared/source/utilities/mem_lifetime.h @@ -15,6 +15,9 @@ using ExtUniquePtrT = std::unique_ptr; template void cloneExt(ExtUniquePtrT &dst, const T &src); +template +void allocateExt(ExtUniquePtrT &dst); + template void destroyExt(T *dst); @@ -51,10 +54,14 @@ struct UniquePtrWrapperOps { } // namespace Impl -template +template struct Ext : Impl::UniquePtrWrapperOps> { Ext(T *ptr) : ptr(ptr, destroyExt) {} - Ext() = default; + Ext() { + if constexpr (allocateAtInit) { + allocateExt(ptr); + } + } Ext(const Ext &rhs) { if (rhs.ptr.get()) { cloneExt(this->ptr, *rhs.ptr.get());