nncase icon indicating copy to clipboard operation
nncase copied to clipboard

[WIP] fix model loading alignement issues on k210

Open louareg opened this issue 4 years ago • 4 comments

louareg avatar Jul 14 '21 11:07 louareg

You should align the model with the minimal alignment (K210 is 256) instead of read_unaligned in interpreter.initialize.

sunnycase avatar Jul 14 '21 11:07 sunnycase

I dont see any method called interpreter::initialize. Maybe you mean interpreter::load_model or runtime_module::initialize ? And which buffer should be aligned ?

louareg avatar Jul 14 '21 15:07 louareg

I checked that the buffer from interpreter::load_model is indeed aligned on a 256 boundary :

buffer's addr 0x801af800

But that is not the problem. The actual problem occurs in k210_runtime_module::visit(const kpu_conv2d_options), where op.activation.start isnt a multiple of 256.

op.activation.start = 560 
op.activation.memory_location =  2

This makes the following check fail

CHECK_WITH_ERR(layer.kernel_calc_type_cfg.data.active_addr % 256 == 0, std::errc::invalid_argument);

louareg avatar Jul 14 '21 15:07 louareg

I dont see any method called interpreter::initialize. Maybe you mean interpreter::load_model or runtime_module::initialize ? And which buffer should be aligned ?

the buffer you passed to interpreter::load_model should be aligned. so read_unaligend is not needed.

sunnycase avatar Jul 14 '21 16:07 sunnycase

Sorry, I think we need to close this pr as it's not valid anymore. Thank you for your contribution.

sunnycase avatar Nov 24 '23 06:11 sunnycase