Skip to content

Commit

Permalink
Update internal ovxlib to release/1.2.22 (#706)
Browse files Browse the repository at this point in the history
* Update internal ovxlib to release/1.2.22

Signed-off-by: Feiyue.Chen <[email protected]>

* Refine yaml file for blocking tfhub model tests

Signed-off-by: Feiyue.Chen <[email protected]>

---------

Signed-off-by: Feiyue.Chen <[email protected]>
  • Loading branch information
chenfeiyue-cfy authored Jan 8, 2025
1 parent 1498348 commit 8494275
Show file tree
Hide file tree
Showing 94 changed files with 9,470 additions and 3,889 deletions.
106 changes: 53 additions & 53 deletions .github/workflows/cmake_x86_vsim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ jobs:
run: |
git config --global user.email "[email protected]"
git config --global user.name "xiang.zhang"
git clone https://github.com/tensorflow/tensorflow.git ${{github.workspace}}/3rd-party/tensorflow && cd ${{github.workspace}}/3rd-party/tensorflow/ && git checkout v2.10.0
git clone https://github.com/tensorflow/tensorflow.git ${{github.workspace}}/3rd-party/tensorflow && cd ${{github.workspace}}/3rd-party/tensorflow/ && git checkout v2.16.1
git clone https://github.com/VeriSilicon/tflite-vx-delegate.git ${{github.workspace}}/vx-delegate
cmake -B ${{github.workspace}}/vx-delegate/build -S ${{github.workspace}}/vx-delegate -DFETCHCONTENT_SOURCE_DIR_TENSORFLOW=${{github.workspace}}/3rd-party/tensorflow -DTIM_VX_INSTALL=${{github.workspace}}/tim-vx.install.dir/ -DTFLITE_ENABLE_NNAPI=OFF -DTFLITE_ENABLE_XNNPACK=OFF
cmake --build ${{github.workspace}}/vx-delegate/build --config ${{env.BUILD_TYPE}}
Expand Down Expand Up @@ -283,61 +283,61 @@ jobs:
# chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
# ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/tfhub.movenet.multipose.tflite

tfhub-efficientdet-lite0:
runs-on: ubuntu-latest
needs: [vx-delegate-build, tim-vx-unit-test]
steps:
- name: download test binary
uses: actions/download-artifact@v3
- name: download model
run: |
wget https://storage.googleapis.com/tfhub-lite-models/tensorflow/lite-model/efficientdet/lite0/detection/metadata/1.tflite
- name: benchmark-model
run: |
chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/1.tflite
# tfhub-efficientdet-lite0:
# runs-on: ubuntu-latest
# needs: [vx-delegate-build, tim-vx-unit-test]
# steps:
# - name: download test binary
# uses: actions/download-artifact@v3
# - name: download model
# run: |
# wget https://storage.googleapis.com/tfhub-lite-models/tensorflow/lite-model/efficientdet/lite0/detection/metadata/1.tflite
# - name: benchmark-model
# run: |
# chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
# ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/1.tflite

tfhub-efficientdet-lite1:
runs-on: ubuntu-latest
needs: [vx-delegate-build, tim-vx-unit-test]
steps:
- name: download test binary
uses: actions/download-artifact@v3
- name: download model
run: |
wget https://storage.googleapis.com/tfhub-lite-models/tensorflow/lite-model/efficientdet/lite1/detection/metadata/1.tflite
- name: benchmark-model
run: |
chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/1.tflite
# tfhub-efficientdet-lite1:
# runs-on: ubuntu-latest
# needs: [vx-delegate-build, tim-vx-unit-test]
# steps:
# - name: download test binary
# uses: actions/download-artifact@v3
# - name: download model
# run: |
# wget https://storage.googleapis.com/tfhub-lite-models/tensorflow/lite-model/efficientdet/lite1/detection/metadata/1.tflite
# - name: benchmark-model
# run: |
# chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
# ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/1.tflite

tfhub-efficientdet-lite2:
runs-on: ubuntu-latest
needs: [vx-delegate-build, tim-vx-unit-test]
steps:
- name: download test binary
uses: actions/download-artifact@v3
- name: download model
run: |
wget https://storage.googleapis.com/tfhub-lite-models/tensorflow/lite-model/efficientdet/lite2/detection/metadata/1.tflite
- name: benchmark-model
run: |
chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/1.tflite
# tfhub-efficientdet-lite2:
# runs-on: ubuntu-latest
# needs: [vx-delegate-build, tim-vx-unit-test]
# steps:
# - name: download test binary
# uses: actions/download-artifact@v3
# - name: download model
# run: |
# wget https://storage.googleapis.com/tfhub-lite-models/tensorflow/lite-model/efficientdet/lite2/detection/metadata/1.tflite
# - name: benchmark-model
# run: |
# chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
# ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/1.tflite

tfhub-efficientdet-lite3:
runs-on: ubuntu-latest
needs: [vx-delegate-build, tim-vx-unit-test]
steps:
- name: download test binary
uses: actions/download-artifact@v3
- name: download model
run: |
wget https://storage.googleapis.com/tfhub-lite-models/tensorflow/lite-model/efficientdet/lite2/detection/metadata/1.tflite
- name: benchmark-model
run: |
chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/1.tflite
# tfhub-efficientdet-lite3:
# runs-on: ubuntu-latest
# needs: [vx-delegate-build, tim-vx-unit-test]
# steps:
# - name: download test binary
# uses: actions/download-artifact@v3
# - name: download model
# run: |
# wget https://storage.googleapis.com/tfhub-lite-models/tensorflow/lite-model/efficientdet/lite2/detection/metadata/1.tflite
# - name: benchmark-model
# run: |
# chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
# ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/1.tflite

# acuity-yolov3-608-quant:
# runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.14
1.2.22
1 change: 1 addition & 0 deletions src/tim/vx/internal/include/custom/custom_node_type.def
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ DEF_NODE_TYPE(custom_sample)
DEF_NODE_TYPE(custom_tiny_yolov4_postprocess)
DEF_NODE_TYPE(custom_tiny_yolov4_postprocess_confidence)
DEF_NODE_TYPE(custom_tiny_yolov4_postprocess_box)
DEF_NODE_TYPE(custom_letterbox)
1 change: 1 addition & 0 deletions src/tim/vx/internal/include/custom/custom_ops.def
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ DEF_OP(CUSTOM_SAMPLE)
DEF_OP(CUSTOM_TINY_YOLOV4_POSTPROCESS)
DEF_OP(CUSTOM_TINY_YOLOV4_POSTPROCESS_CONFIDENCE)
DEF_OP(CUSTOM_TINY_YOLOV4_POSTPROCESS_BOX)
DEF_OP(CUSTOM_LETTERBOX)
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/****************************************************************************
*
* Copyright (c) 2020 Vivante Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef _VSI_NN_OP_CUSTOM_LETTERBOX_H
#define _VSI_NN_OP_CUSTOM_LETTERBOX_H

#include "vsi_nn_types.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct _vsi_nn_custom_letterbox_param
{
struct _custom_letterbox_local_data_t* local;
int32_t new_shape_w;
int32_t new_shape_h;
vx_bool auto_bool;
vx_bool scaleFill;
vx_bool scaleup;
int32_t stride;
vx_bool center;
float mean_r;
float mean_g;
float mean_b;
float scale_r;
float scale_g;
float scale_b;
int32_t pad_value_r;
int32_t pad_value_g;
int32_t pad_value_b;
vx_bool reverse_channel;
} vsi_nn_custom_letterbox_param;
_compiler_assert(offsetof(vsi_nn_custom_letterbox_param, local) == 0, \
vsi_nn_custom_lertterbox_h );

#ifdef __cplusplus
}
#endif

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@
#include "custom/ops/vsi_nn_op_custom_tiny_yolov4_postprocess.h"
#include "custom/ops/vsi_nn_op_custom_tiny_yolov4_postprocess_confidence.h"
#include "custom/ops/vsi_nn_op_custom_tiny_yolov4_postprocess_box.h"
#include "custom/ops/vsi_nn_op_custom_letterbox.h"

#endif
1 change: 1 addition & 0 deletions src/tim/vx/internal/include/interface/ops.def
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,4 @@ DEF_OP(BITCAST)
DEF_OP(GROUPED_CONV3D)
DEF_OP(COL2IM)
DEF_OP(L1_LAYER_NORM)
DEF_OP(ROPE)
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ typedef struct _vsi_nn_pre_process_rgb_param
float g_scale;
float b_scale;
/* pre process rgb layer local data structure */
vsi_nn_pre_process_rgb_lcl_data local;
vsi_nn_pre_process_rgb_lcl_data *local;
} vsi_nn_pre_process_rgb_param;

#ifdef __cplusplus
Expand Down
49 changes: 49 additions & 0 deletions src/tim/vx/internal/include/ops/vsi_nn_op_rope.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/****************************************************************************
*
* Copyright (c) 2020 Vivante Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/

#ifndef _VSI_NN_OP_ROPE_H
#define _VSI_NN_OP_ROPE_H

#include "vsi_nn_types.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct _vsi_nn_rope_param
{
struct _rope_local_data_t* local;
// Add parameters here
int32_t axis;
vsi_bool interleaved;
} vsi_nn_rope_param;
_compiler_assert(offsetof(vsi_nn_rope_param, local) == 0, \
vsi_nn_rope_h );

#ifdef __cplusplus
}
#endif

#endif

1 change: 1 addition & 0 deletions src/tim/vx/internal/include/ops/vsi_nn_op_topk.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ typedef struct _vsi_nn_topk_param
{
uint32_t k;
int32_t axis;
struct _topk_local_data_t* local;
} vsi_nn_topk_param;

#ifdef __cplusplus
Expand Down
16 changes: 4 additions & 12 deletions src/tim/vx/internal/include/utils/vsi_nn_dtype_util_prv.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,25 +384,17 @@ static VSI_INLINE_API float fp16_to_fp32

static VSI_INLINE_API float bfp16_to_fp32
(
int16_t in
uint16_t in
)
{
uint32_t t1, t2, t3;
float out;
fp32_bit_cast_t fp32_bit_cast;

t1 = in & 0x00FF; // Mantissa
t2 = in & 0xFF00; // Sign bit + Exponent
t3 = in & 0x7F00; // Exponent

t1 <<= 16;
t2 <<= 16; // Shift (sign + Exponent) bit into position
t1 |= t2; // Re-insert (sign + Exponent) bit
fp32_bit_cast.data = (uint32_t)(in << 16);

fp32_bit_cast.data = t1;
out = fp32_bit_cast.val;

return t3 == 0 ? 0.0f : out;
return out;
} /* bfp16_to_fp32() */

static VSI_INLINE_API uint16_t fp32_to_fp16
Expand Down Expand Up @@ -720,7 +712,7 @@ static VSI_INLINE_API vsi_status dtype_to_float32
*dst = fp16_to_fp32( *(int16_t *)src );
break;
case VSI_NN_TYPE_BFLOAT16:
*dst = bfp16_to_fp32( *(int16_t *)src );
*dst = bfp16_to_fp32( *(uint16_t *)src );
break;
case VSI_NN_TYPE_FLOAT8_E4M3:
*dst = fp8_e4m3_to_fp32(*(int8_t*)src, src_dtype->scale);
Expand Down
Loading

0 comments on commit 8494275

Please sign in to comment.