Skip to content

Commit

Permalink
Only pass scalars in a single buffer.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsharletg committed Jul 14, 2017
1 parent 2eecff2 commit 8b7a061
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 173 deletions.
Binary file not shown.
Binary file not shown.
4 changes: 3 additions & 1 deletion src/runtime/hexagon_remote/bin/src/halide_hexagon_remote.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#ifndef _HALIDE_HEXAGON_REMOTE_H
#define _HALIDE_HEXAGON_REMOTE_H
#include "AEEStdDef.h"
#ifndef __QAIC_HEADER
#define __QAIC_HEADER(ff) ff
#endif //__QAIC_HEADER
Expand Down Expand Up @@ -33,11 +34,12 @@ struct _halide_hexagon_remote_buffer__seq_octet {
int dataLen;
};
typedef unsigned int halide_hexagon_remote_handle_t;
typedef uint64 halide_hexagon_remote_scalar_t;
__QAIC_HEADER_EXPORT int __QAIC_HEADER(halide_hexagon_remote_initialize_kernels_v3)(const unsigned char* code, int codeLen, halide_hexagon_remote_handle_t* module_ptr) __QAIC_HEADER_ATTRIBUTE;
__QAIC_HEADER_EXPORT int __QAIC_HEADER(halide_hexagon_remote_get_symbol_v4)(halide_hexagon_remote_handle_t module_ptr, const char* name, int nameLen, halide_hexagon_remote_handle_t* sym_ptr) __QAIC_HEADER_ATTRIBUTE;
__QAIC_HEADER_EXPORT int __QAIC_HEADER(halide_hexagon_remote_power_hvx_on)(void) __QAIC_HEADER_ATTRIBUTE;
__QAIC_HEADER_EXPORT int __QAIC_HEADER(halide_hexagon_remote_power_hvx_off)(void) __QAIC_HEADER_ATTRIBUTE;
__QAIC_HEADER_EXPORT int __QAIC_HEADER(halide_hexagon_remote_run_v2)(halide_hexagon_remote_handle_t module_ptr, halide_hexagon_remote_handle_t symbol, const halide_hexagon_remote_buffer* input_buffers, int input_buffersLen, halide_hexagon_remote_buffer* output_buffers, int output_buffersLen, int scalar_count, const unsigned char* small_input_args, int small_input_argsLen) __QAIC_HEADER_ATTRIBUTE;
__QAIC_HEADER_EXPORT int __QAIC_HEADER(halide_hexagon_remote_run_v2)(halide_hexagon_remote_handle_t module_ptr, halide_hexagon_remote_handle_t symbol, const halide_hexagon_remote_buffer* input_buffers, int input_buffersLen, halide_hexagon_remote_buffer* output_buffers, int output_buffersLen, const halide_hexagon_remote_scalar_t* scalars, int scalarsLen) __QAIC_HEADER_ATTRIBUTE;
__QAIC_HEADER_EXPORT int __QAIC_HEADER(halide_hexagon_remote_release_kernels_v2)(halide_hexagon_remote_handle_t module_ptr) __QAIC_HEADER_ATTRIBUTE;
__QAIC_HEADER_EXPORT int __QAIC_HEADER(halide_hexagon_remote_poll_log)(char* log, int logLen, int* read_size) __QAIC_HEADER_ATTRIBUTE;
__QAIC_HEADER_EXPORT int __QAIC_HEADER(halide_hexagon_remote_poll_profiler_state)(int* func, int* threads) __QAIC_HEADER_ATTRIBUTE;
Expand Down
34 changes: 16 additions & 18 deletions src/runtime/hexagon_remote/bin/src/halide_hexagon_remote_skel.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,16 +418,16 @@ struct Interface {
#define __QAIC_SLIM_EXPORT
#endif

static const Type types[2];
static const Type types[3];
static const SequenceType sequenceTypes[1] = {{&(types[1]),0x0,0x4,0x4,0x0}};
static const Type types[2] = {{0x1,{{(const uintptr_t)0,(const uintptr_t)0}}, 2,0x1},{SLIM_IFPTR32(0x8,0x10),{{(const uintptr_t)&(types[0]),(const uintptr_t)0x0}}, 9,SLIM_IFPTR32(0x4,0x8)}};
static const Parameter parameters[8] = {{SLIM_IFPTR32(0x8,0x10),{{(const uintptr_t)&(types[0]),(const uintptr_t)0x0}}, 9,SLIM_IFPTR32(0x4,0x8),0,0},{0x4,{{(const uintptr_t)0,(const uintptr_t)0}}, 2,0x4,3,0},{0x4,{{(const uintptr_t)0,(const uintptr_t)0}}, 2,0x4,0,0},{SLIM_IFPTR32(0x8,0x10),{{(const uintptr_t)&(sequenceTypes[0]),0}}, 25,SLIM_IFPTR32(0x4,0x8),0,0},{SLIM_IFPTR32(0x8,0x10),{{(const uintptr_t)&(sequenceTypes[0]),0}}, 25,SLIM_IFPTR32(0x4,0x8),3,0},{0x4,{{(const uintptr_t)0,(const uintptr_t)1}}, 2,0x4,0,0},{SLIM_IFPTR32(0x8,0x10),{{(const uintptr_t)&(types[0]),(const uintptr_t)0x0}}, 9,SLIM_IFPTR32(0x4,0x8),3,0},{0x4,{{(const uintptr_t)0,(const uintptr_t)1}}, 2,0x4,3,0}};
static const Parameter* const parameterArrays[21] = {(&(parameters[5])),(&(parameters[2])),(&(parameters[2])),(&(parameters[5])),(&(parameters[2])),(&(parameters[2])),(&(parameters[5])),(&(parameters[5])),(&(parameters[2])),(&(parameters[2])),(&(parameters[3])),(&(parameters[4])),(&(parameters[5])),(&(parameters[0])),(&(parameters[2])),(&(parameters[0])),(&(parameters[1])),(&(parameters[7])),(&(parameters[7])),(&(parameters[6])),(&(parameters[7]))};
static const Method methods[9] = {{REMOTE_SCALARS_MAKEX(0,0,0x2,0x1,0x0,0x0),0x4,0x4,3,2,(&(parameterArrays[15])),0x4,0x4},{REMOTE_SCALARS_MAKEX(0,0,0x2,0x1,0x0,0x0),0x8,0x4,4,3,(&(parameterArrays[14])),0x4,0x4},{REMOTE_SCALARS_MAKEX(0,0,0x0,0x0,0x0,0x0),0x0,0x0,0,0,0,0x0,0x0},{REMOTE_SCALARS_MAKEX(0,0,255,255,15,15),0x18,0x0,10,6,(&(parameterArrays[8])),0x4,0x1},{REMOTE_SCALARS_MAKEX(0,0,0x1,0x0,0x0,0x0),0x4,0x0,1,1,(&(parameterArrays[1])),0x4,0x0},{REMOTE_SCALARS_MAKEX(0,0,0x1,0x2,0x0,0x0),0x4,0x4,4,2,(&(parameterArrays[19])),0x4,0x4},{REMOTE_SCALARS_MAKEX(0,0,0x0,0x1,0x0,0x0),0x0,0x8,2,2,(&(parameterArrays[17])),0x1,0x4},{REMOTE_SCALARS_MAKEX(0,0,0x1,0x0,0x0,0x0),0x4,0x0,1,1,(&(parameterArrays[0])),0x4,0x0},{REMOTE_SCALARS_MAKEX(0,0,0x1,0x0,0x0,0x0),0x20,0x0,8,8,(&(parameterArrays[0])),0x4,0x0}};
static const Type types[3] = {{0x1,{{(const uintptr_t)0,(const uintptr_t)0}}, 2,0x1},{SLIM_IFPTR32(0x8,0x10),{{(const uintptr_t)&(types[0]),(const uintptr_t)0x0}}, 9,SLIM_IFPTR32(0x4,0x8)},{0x8,{{(const uintptr_t)0,(const uintptr_t)0}}, 2,0x8}};
static const Parameter parameters[9] = {{SLIM_IFPTR32(0x8,0x10),{{(const uintptr_t)&(types[0]),(const uintptr_t)0x0}}, 9,SLIM_IFPTR32(0x4,0x8),0,0},{0x4,{{(const uintptr_t)0,(const uintptr_t)0}}, 2,0x4,3,0},{0x4,{{(const uintptr_t)0,(const uintptr_t)0}}, 2,0x4,0,0},{SLIM_IFPTR32(0x8,0x10),{{(const uintptr_t)&(sequenceTypes[0]),0}}, 25,SLIM_IFPTR32(0x4,0x8),0,0},{SLIM_IFPTR32(0x8,0x10),{{(const uintptr_t)&(sequenceTypes[0]),0}}, 25,SLIM_IFPTR32(0x4,0x8),3,0},{SLIM_IFPTR32(0x8,0x10),{{(const uintptr_t)&(types[2]),(const uintptr_t)0x0}}, 9,SLIM_IFPTR32(0x4,0x8),0,0},{SLIM_IFPTR32(0x8,0x10),{{(const uintptr_t)&(types[0]),(const uintptr_t)0x0}}, 9,SLIM_IFPTR32(0x4,0x8),3,0},{0x4,{{(const uintptr_t)0,(const uintptr_t)1}}, 2,0x4,3,0},{0x4,{{(const uintptr_t)0,(const uintptr_t)1}}, 2,0x4,0,0}};
static const Parameter* const parameterArrays[20] = {(&(parameters[8])),(&(parameters[2])),(&(parameters[2])),(&(parameters[8])),(&(parameters[2])),(&(parameters[2])),(&(parameters[8])),(&(parameters[8])),(&(parameters[2])),(&(parameters[2])),(&(parameters[3])),(&(parameters[4])),(&(parameters[5])),(&(parameters[2])),(&(parameters[0])),(&(parameters[1])),(&(parameters[7])),(&(parameters[7])),(&(parameters[6])),(&(parameters[7]))};
static const Method methods[9] = {{REMOTE_SCALARS_MAKEX(0,0,0x2,0x1,0x0,0x0),0x4,0x4,3,2,(&(parameterArrays[14])),0x4,0x4},{REMOTE_SCALARS_MAKEX(0,0,0x2,0x1,0x0,0x0),0x8,0x4,4,3,(&(parameterArrays[13])),0x4,0x4},{REMOTE_SCALARS_MAKEX(0,0,0x0,0x0,0x0,0x0),0x0,0x0,0,0,0,0x0,0x0},{REMOTE_SCALARS_MAKEX(0,0,255,255,15,15),0x14,0x0,9,5,(&(parameterArrays[8])),0x4,0x1},{REMOTE_SCALARS_MAKEX(0,0,0x1,0x0,0x0,0x0),0x4,0x0,1,1,(&(parameterArrays[1])),0x4,0x0},{REMOTE_SCALARS_MAKEX(0,0,0x1,0x2,0x0,0x0),0x4,0x4,4,2,(&(parameterArrays[18])),0x4,0x4},{REMOTE_SCALARS_MAKEX(0,0,0x0,0x1,0x0,0x0),0x0,0x8,2,2,(&(parameterArrays[16])),0x1,0x4},{REMOTE_SCALARS_MAKEX(0,0,0x1,0x0,0x0,0x0),0x4,0x0,1,1,(&(parameterArrays[0])),0x4,0x0},{REMOTE_SCALARS_MAKEX(0,0,0x1,0x0,0x0,0x0),0x20,0x0,8,8,(&(parameterArrays[0])),0x4,0x0}};
static const Method* const methodArrays[10] = {&(methods[0]),&(methods[1]),&(methods[2]),&(methods[2]),&(methods[3]),&(methods[4]),&(methods[5]),&(methods[6]),&(methods[7]),&(methods[8])};
static const char strings[368] = "initialize_kernels_v3\0busbwUsagePercentage\0set_performance_mode\0poll_profiler_state\0release_kernels_v2\0bwMegabytesPerSec\0small_input_args\0set_performance\0output_buffers\0mipsPerThread\0input_buffers\0power_hvx_off\0get_symbol_v4\0scalar_count\0power_hvx_on\0set_latency\0set_bus_bw\0module_ptr\0mipsTotal\0read_size\0set_mips\0poll_log\0threads\0sym_ptr\0symbol\0run_v2\0func\0name\0code\0";
static const uint16_t methodStrings[35] = {138,305,169,285,263,103,22,251,255,346,274,339,183,154,225,121,211,274,358,331,64,353,323,314,319,295,0,363,274,43,59,84,274,197,238};
static const uint16_t methodStringsArrays[10] = {26,16,34,33,9,31,23,20,29,0};
static const char strings[346] = "initialize_kernels_v3\0busbwUsagePercentage\0set_performance_mode\0poll_profiler_state\0release_kernels_v2\0bwMegabytesPerSec\0set_performance\0output_buffers\0mipsPerThread\0input_buffers\0power_hvx_off\0get_symbol_v4\0power_hvx_on\0set_latency\0set_bus_bw\0module_ptr\0mipsTotal\0read_size\0set_mips\0poll_log\0threads\0scalars\0sym_ptr\0symbol\0run_v2\0func\0name\0code\0";
static const uint16_t methodStrings[34] = {121,275,152,255,233,103,22,221,225,324,244,317,166,137,301,194,244,336,309,64,331,293,284,289,265,0,341,244,43,59,84,244,180,208};
static const uint16_t methodStringsArrays[10] = {25,15,33,32,9,30,22,19,28,0};
__QAIC_SLIM_EXPORT const Interface __QAIC_SLIM(halide_hexagon_remote_slim) = {10,&(methodArrays[0]),0,0,&(methodStringsArrays [0]),methodStrings,strings};
#endif //_HALIDE_HEXAGON_REMOTE_SLIM_H
extern int adsp_mmap_fd_getinfo(int, uint32_t *);
Expand Down Expand Up @@ -570,17 +570,16 @@ static __inline int _skel_unpack_1(_allocator* _al, remote_arg* _praIn, remote_a
_CATCH(_nErr) {}
return _nErr;
}
static __inline int _skel_method_4(int (*_pfn)(uint32_t, uint32_t, void*, uint32_t, void*, uint32_t, uint32_t, char*, uint32_t), uint32_t _sc, remote_arg* _pra) {
static __inline int _skel_method_4(int (*_pfn)(uint32_t, uint32_t, void*, uint32_t, void*, uint32_t, char*, uint32_t), uint32_t _sc, remote_arg* _pra) {
remote_arg* _praEnd;
uint32_t _in0[1];
uint32_t _in1[1];
void* _in2[1];
uint32_t _in2Len[1];
void* _rout3[1];
uint32_t _rout3Len[1];
uint32_t _in4[1];
char* _in5[1];
uint32_t _in5Len[1];
char* _in4[1];
uint32_t _in4Len[1];
uint32_t* _primIn;
int _numIn[1];
remote_arg* _praIn;
Expand All @@ -599,7 +598,7 @@ static __inline int _skel_method_4(int (*_pfn)(uint32_t, uint32_t, void*, uint32
_praEnd = ((_pra + REMOTE_SCALARS_INBUFS(_sc)) + REMOTE_SCALARS_OUTBUFS(_sc) + REMOTE_SCALARS_INHANDLES(_sc) + REMOTE_SCALARS_OUTHANDLES(_sc));
_ASSERT(_nErr, (_pra + ((4 + 0) + (0 + 0))) <= _praEnd);
_numIn[0] = (REMOTE_SCALARS_INBUFS(_sc) - 1);
_ASSERT(_nErr, _pra[0].buf.nLen >= 24);
_ASSERT(_nErr, _pra[0].buf.nLen >= 20);
_primIn = _pra[0].buf.pv;
_praIn = (_pra + 1);
_praROut = (_praIn + _numIn[0] + 0);
Expand All @@ -621,11 +620,10 @@ static __inline int _skel_method_4(int (*_pfn)(uint32_t, uint32_t, void*, uint32
{
_TRY(_nErr, _skel_unpack(_al, (_praIn + 2), _ppraIn, (_praROut + 0), _ppraROut, _seq_primIn3, 0, SLIM_IFPTR32((char**)&(((uint32_t*)_seq_nat3)[0]), (char**)&(((uint64_t*)_seq_nat3)[0])), SLIM_IFPTR32((uint32_t*)&(((uint32_t*)_seq_nat3)[1]), (uint32_t*)&(((uint32_t*)_seq_nat3)[2]))));
}
_COPY(_in4, 0, _primIn, 16, 4);
_COPY(_in5Len, 0, _primIn, 20, 4);
_ASSERT(_nErr, (int)((_praIn[2].buf.nLen / 1)) >= (int)(_in5Len[0]));
_in5[0] = _praIn[2].buf.pv;
_TRY(_nErr, _pfn(*_in0, *_in1, *_in2, *_in2Len, *_rout3, *_rout3Len, *_in4, *_in5, *_in5Len));
_COPY(_in4Len, 0, _primIn, 16, 4);
_ASSERT(_nErr, (int)((_praIn[2].buf.nLen / 8)) >= (int)(_in4Len[0]));
_in4[0] = _praIn[2].buf.pv;
_TRY(_nErr, _pfn(*_in0, *_in1, *_in2, *_in2Len, *_rout3, *_rout3Len, *_in4, *_in4Len));
for(_ii = 0, _seq_nat2 = (char*)_in2[0];_ii < (int)_in2Len[0];++_ii, _seq_nat2 = (_seq_nat2 + SLIM_IFPTR32(8, 16)))
{
_TRY(_nErr, _skel_pack_1((_praROutPost + 0), _ppraROutPost, 0, SLIM_IFPTR32((char**)&(((uint32_t*)_seq_nat2)[0]), (char**)&(((uint64_t*)_seq_nat2)[0])), SLIM_IFPTR32((uint32_t*)&(((uint32_t*)_seq_nat2)[1]), (uint32_t*)&(((uint32_t*)_seq_nat2)[2]))));
Expand Down
Loading

0 comments on commit 8b7a061

Please sign in to comment.