Skip to content

Commit

Permalink
[GPU] Init tensor.data when allocating inputs for string type (openvi…
Browse files Browse the repository at this point in the history
…notoolkit#27269)

### Details:
- In case the element type is string produces the segmentation fault
when input data is an empty string, unless the each element of
tensor.data is initialized.

### Tickets:
 - 148921
  • Loading branch information
davidsnam-intel authored Oct 30, 2024
1 parent cb292c7 commit a7ff891
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/plugins/intel_gpu/src/plugin/sync_infer_request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,12 @@ void SyncInferRequest::allocate_input(const ov::Output<const ov::Node>& port, si
auto element_type = port.get_element_type();

m_user_inputs[input_idx] = { create_host_tensor(shape, element_type), TensorOwner::PLUGIN };
if (element_type == ov::element::string) {
// In case the element type is string and input data is an empty string,
// it produces the segmentation fault unless the each element of tensor.data is initialized.
auto data = m_user_inputs.at(input_idx).ptr->data<std::string>();
std::uninitialized_fill_n(data, m_user_inputs.at(input_idx).ptr->get_size(), std::string());
}
ov::ISyncInferRequest::set_tensor(port, m_user_inputs.at(input_idx).ptr);
}

Expand Down
2 changes: 0 additions & 2 deletions tests/layer_tests/tensorflow_tests/test_tf_LookupTableSize.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ def create_lookup_table_size_net(self, hash_table_type, keys_type, values_type,
def test_lookup_table_size(self, hash_table_type, params, ie_device, precision, ir_version, temp_dir,
use_legacy_frontend):
keys_type = params['keys_type']
if ie_device == 'GPU' and keys_type == str:
pytest.skip("148921: Segmentation fault on GPU")
self._test(*self.create_lookup_table_size_net(hash_table_type=hash_table_type, **params),
ie_device, precision, ir_version, temp_dir=temp_dir,
use_legacy_frontend=use_legacy_frontend)

0 comments on commit a7ff891

Please sign in to comment.