Robert
Robert

Reputation: 133

Multiple instances of tensorflow lite with NNAPI delegate

NNAPI Delegate in Tensorflow lite uses shared memory for input and output tensors of the graph. However the name of the shared memory pool is hardcoded ("input_pool" and "otput_pool"):

  // Create shared memory pool for inputs and outputs.
  nn_input_memory_.reset(
      new NNMemory(nnapi_, "input_pool", total_input_byte_size));
  nn_output_memory_.reset(
      new NNMemory(nnapi_, "output_pool", total_output_byte_size));

Now what happens if multiple instances of tensorflow lite with NNAPI delegate are executed? Per my understanding as all of them will map and use the same shared memory pool. Doesn't this lead to race condition?

Upvotes: 0

Views: 229

Answers (1)

galarragas
galarragas

Reputation: 44

The name given to the shared name is just used as a label. Using the same name when creating two different shared memory regions won't cause the same memory to be used. See for example the case where no name is provided and all regions are created with the name "none"

Upvotes: 1

Related Questions