-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
82ad92d
commit 766c845
Showing
4 changed files
with
95 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ use dla_driver::tensor3::{Order3, Tensor3}; | |
use dla_driver::tensor4::{Order4, Tensor4}; | ||
use dla_driver::utils::optimal_pp_bias_heuristic; | ||
use dla_driver::{Padding, Stride}; | ||
use headsail_bsp::init_heap; | ||
|
||
/// Converts C-types to DLA Tensors for use with the highlevel layer | ||
#[allow(clippy::too_many_arguments)] | ||
|
@@ -72,7 +73,8 @@ unsafe fn ffi_data_import( | |
/// Initializes DLA by setting up necessary heap allocator from headsail-bsp. This should be called only once in the program. | ||
#[no_mangle] | ||
pub unsafe extern "C" fn dla_init() { | ||
headsail_bsp::init_heap(); | ||
// SAFETY: `init_heap` must be called once only | ||
unsafe { init_heap() }; | ||
} | ||
|
||
/// Executes Conv2D on DLA with given parameters and writes result to output buffer. | ||
|
@@ -444,8 +446,6 @@ pub unsafe extern "C" fn dla_tvm_qnn_conv2d_bias( | |
None, | ||
); | ||
|
||
let _input_order_string = unsafe { CStr::from_ptr(input_order).to_str().unwrap_unchecked() }; | ||
|
||
// TVM requantization and clip | ||
// NOTE:(20240927 [email protected]) on DLA clipping behaviour with TVM. | ||
// DLA's conv2d arithmetic is done at 16 bit width, but the output of the DLA is limited to 8 bits. | ||
|
@@ -540,8 +540,6 @@ pub unsafe extern "C" fn dla_tvm_qnn_conv2d_grouped_bias( | |
groups, | ||
); | ||
|
||
let _input_order_string = unsafe { CStr::from_ptr(input_order).to_str().unwrap_unchecked() }; | ||
|
||
// TVM requantization and clip | ||
// NOTE:(20240927 [email protected]) on DLA clipping behaviour with TVM. | ||
// DLA's conv2d arithmetic is done at 16 bit width, but the output of the DLA is limited to 8 bits. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters