Skip to content

Commit

Permalink
[GPU] Model cache segfault fix (openvinotoolkit#27377)
Browse files Browse the repository at this point in the history
### Details:
- Primitives can be opt-out. In that case, it does not have kernel data.

### Tickets:
 - 156592
  • Loading branch information
isanghao authored Nov 5, 2024
1 parent b8c5bd8 commit cde4e97
Show file tree
Hide file tree
Showing 31 changed files with 35 additions and 39 deletions.
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/activation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct activation_impl : typed_primitive_impl_ocl<activation> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/arg_max_min.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct arg_max_min_impl : typed_primitive_impl_ocl<arg_max_min> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/border.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ struct border_impl : typed_primitive_impl_ocl<border> {
void load(BinaryInputBuffer& ib) override {
parent::load(ib);
ib >> zero_input;
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/broadcast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct broadcast_impl : typed_primitive_impl_ocl<broadcast> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct concatenation_impl : typed_primitive_impl_ocl<concatenation> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/crop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct crop_impl : typed_primitive_impl_ocl<crop> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/cum_sum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct cum_sum_impl : typed_primitive_impl_ocl<cum_sum> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct dynamic_quantize_impl : typed_primitive_impl_ocl<dynamic_quantize> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/eltwise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct eltwise_impl : typed_primitive_impl_ocl<eltwise> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct fully_connected_impl : typed_primitive_impl_ocl<fully_connected> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/gather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct gather_impl : typed_primitive_impl_ocl<gather> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct gather_elements_impl : typed_primitive_impl_ocl<gather_elements> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/gather_nd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct gather_nd_impl : typed_primitive_impl_ocl<gather_nd> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct group_normalization_impl : typed_primitive_impl_ocl<group_normalization>

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/mvn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct mvn_impl : typed_primitive_impl_ocl<mvn> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/intel_gpu/src/graph/impls/ocl/non_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct count_nonzero_impl : typed_primitive_impl_ocl<count_nonzero> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down Expand Up @@ -72,7 +72,7 @@ struct gather_nonzero_impl : typed_primitive_impl_ocl<gather_nonzero> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/permute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct permute_impl : typed_primitive_impl_ocl<permute> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/quantize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct quantize_impl : typed_primitive_impl_ocl<quantize> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/range.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct range_impl : typed_primitive_impl_ocl<range> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
10 changes: 3 additions & 7 deletions src/plugins/intel_gpu/src/graph/impls/ocl/reorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,10 @@ struct reorder_impl : typed_primitive_impl_ocl<reorder> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
if (!_kernel_data.kernelName.empty()) {
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
} else {
GPU_DEBUG_TRACE_DETAIL << "Fail to update dispatch data because kernel name is empty" << std::endl;
}
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/rms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct rms_impl : typed_primitive_impl_ocl<rms> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/rope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct rope_impl : typed_primitive_impl_ocl<rope> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct scatter_nd_update_impl : typed_primitive_impl_ocl<scatter_nd_update> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct scatter_update_impl : typed_primitive_impl_ocl<scatter_update> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/select.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct select_impl : typed_primitive_impl_ocl<select> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/slice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct slice_impl : typed_primitive_impl_ocl<slice> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/softmax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct softmax_impl : typed_primitive_impl_ocl<softmax> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ struct strided_slice_impl : typed_primitive_impl_ocl<strided_slice> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/swiglu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct swiglu_impl : typed_primitive_impl_ocl<swiglu> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct tile_impl : typed_primitive_impl_ocl<tile> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/intel_gpu/src/graph/impls/ocl/unique.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct unique_count_impl : typed_primitive_impl_ocl<unique_count> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down Expand Up @@ -106,7 +106,7 @@ struct unique_gather_impl : typed_primitive_impl_ocl<unique_gather> {

void load(BinaryInputBuffer& ib) override {
parent::load(ib);
if (is_dynamic()) {
if (is_dynamic() && _kernel_data.kernelName.length() != 0) {
auto& kernel_selector = kernel_selector_t::Instance();
auto kernel_impl = kernel_selector.GetImplementation(_kernel_data.kernelName);
kernel_impl->GetUpdateDispatchDataFunc(_kernel_data);
Expand Down

0 comments on commit cde4e97

Please sign in to comment.