Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing layout of weights as desired for NPUW. #1

Closed
wants to merge 48 commits into from

Conversation

ujjayant-kadian
Copy link
Owner

Details:

  • item1
  • ...

Tickets:

  • ticket-id

@@ -1095,6 +1095,18 @@ void ov::npuw::util::unpack(const ov::SoPtr<ov::ITensor>& from,
#undef CAST
}

void transpose_data_f16(const int16_t* src_data, int16_t* dst_data, size_t dim1, size_t dim2, size_t dim3) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have already existing function for permute/tranpose?

Naive implementation can be done even simpler by just copying data to the tensor with different strides.
e.g let's assume original layout is NCHW [1, 3, 10, 15] but you need NHWC

  1. Create tensor with NHWC layout: ov::Tensor tmp([1, 10, 15, 3], ...);
  2. Copy data from existing tensor: orig.copy_to(tmp); <- this basically transpose data as tmp has different strides
  3. orig.set_shape([1, 10, 15, 3])
  4. tmp.copy_to(orig)

Copy link
Owner Author

@ujjayant-kadian ujjayant-kadian Jul 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried this implementation particularly:

    const auto& to_shape = to->get_shape();
    size_t dim1 = to_shape[0];
    size_t dim2 = to_shape[1];
    size_t dim3 = to_shape[2];
    ov::Shape new_shape = {dim2, dim3, dim1};
    ov::Tensor tmp(to->get_element_type(), new_shape);
    ov::SoPtr<ov::ITensor> tmp_itensor = ov::get_tensor_impl(tmp);
    to->set_shape(new_shape);
    to->copy_to(tmp_itensor._ptr);
    tmp_itensor->copy_to(to._ptr);
    std::cout << "To new shape: " << to->get_shape() << std::endl; 

But when I verified, by testing if the actual data is transposed or not. It turns out not. So moved back to earlier implementation.

@ujjayant-kadian
Copy link
Owner Author

After these changes, I get the following error:

[ NPUW: ERR ] Subgraph [1] - FAILED to run infer request:
Check 'is_dynamic || port.get_shape() == tensor->get_shape()' failed at src/inference/src/dev/isync_infer_request.cpp:277:
The input tensor size is not equal to the model input type: got [32,128,12288] expecting [12288,32,128].

dmatveev and others added 6 commits July 22, 2024 16:15
…on) (openvinotoolkit#25612)

### Details:

- There was an early return in the partitioning compiler in the case of
pipeline "NONE", which in fact returned some empty result;
- There was a handling for such empty result in the `Partitioner` class
which, for this case, created a "full model" partition stub and pass it
to `CompiledModel`, which handled this case & created just a single
subgraph.
- The downside of this is several transformations couldn't be applied to
this path as e.g. function pipeline processing was bypassed.
- This PR changes the "NONE" mode to return a whole-model partition
which still can pass the remaining processing pipeline (no early
return), so options like "CWAI" and "FUNCALL_FOR_ALL" can be applied on
top to get the required transformations.

### Tickets:
 - E-130721

---------

Co-authored-by: Alexey Smirnov <alexey.smirnov@intel.com>
### Details:
 - *Move pytorch transformation tests*
 - *Split nightly scope*

### Tickets:
 - *ticket-id*
…ncy (openvinotoolkit#25522)

### Details:
 - Implement initial e2e testing

### Tickets:
 - 146346

---------

Co-authored-by: Alicja Miloszewska <alicja.miloszewska@intel.com>
…toolkit#25648)

### Details:
 - *item1*
 - *...*

### Tickets:
 - *CVS-143832*
xipingyan and others added 5 commits July 23, 2024 03:24
…zed models (openvinotoolkit#25478)

### Details:
- *Disable ConvertGatherToGatherCompressed pass in case `useLPT` is
false*

### Tickets:
 - *138337*

---------

Signed-off-by: xipingya <xiping.yan@intel.com>
…g.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…penvinotoolkit#25663)

### Details:
 - use std::move
 - use const auto& where possible
 - Wrap test with anonymous namespace

### Tickets:
 [CVS-141675](https://jira.devtools.intel.com/browse/CVS-141675)
 [CVS-147342](https://jira.devtools.intel.com/browse/CVS-147342)

### Related to:
 [CVS-25639](openvinotoolkit#25639)
Kadian added 2 commits July 23, 2024 13:00
…jjayant-kadian/openvino into uk/adding-new-option-change-layout-npw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment