modeld: Move from SNPE to tinygrad (#25207)
* compiling, won't work yet * running with inputs and outputs * there's some magic chance this works * no more dlc, include onnx * yolo tests plz * bump tinygrad * files_common + delete dlc * tinygrad_repo -> tinygrad * pre commit config * llops needed * extra in files_common * bump tinygrad * fix indent * tinygrad/nn/__init__ * tinygrad_repo * bump tinygrad repo * bump tinygrad * bump with native_exp, match maybe * native_explog is argument * pyopencl no cache * 5% chance this matches * work in float32? * bump tinygrad * fix build * no __init__ * fix recip * dumb hack * adding thneed PC support * fix pc segfault * pc thneed is working * to_image * prints stuff with debug=2 * it sort of works * copy host ptr is simpler * bug fix * build on c3 * this correct? * reenable float16 * fix private, fixup copy_inputs internal * bump tinygrad and update ref commit * fix OPTWG on PC * maybe fix non determinism * revert model replay ref commit * comments, init zeroed out buffers * upd ref commit * bump tinygrad to fix initial image * try this ref Co-authored-by: Comma Device <device@comma.ai>pull/25639/head
parent
4bb399ba3c
commit
40d6f4b65c
17 changed files with 143 additions and 39 deletions
@ -1,3 +0,0 @@ |
||||
version https://git-lfs.github.com/spec/v1 |
||||
oid sha256:93d265fc88f05746ce47257e15fc2afe43b250b44715313049f829e8aa30a9d6 |
||||
size 94302331 |
@ -0,0 +1,40 @@ |
||||
#include "selfdrive/modeld/thneed/thneed.h" |
||||
|
||||
#include <cassert> |
||||
|
||||
#include "common/clutil.h" |
||||
#include "common/timing.h" |
||||
|
||||
Thneed::Thneed(bool do_clinit, cl_context _context) { |
||||
context = _context; |
||||
if (do_clinit) clinit(); |
||||
char *thneed_debug_env = getenv("THNEED_DEBUG"); |
||||
debug = (thneed_debug_env != NULL) ? atoi(thneed_debug_env) : 0; |
||||
} |
||||
|
||||
void Thneed::execute(float **finputs, float *foutput, bool slow) { |
||||
uint64_t tb, te; |
||||
if (debug >= 1) tb = nanos_since_boot(); |
||||
|
||||
// ****** copy inputs
|
||||
copy_inputs(finputs); |
||||
|
||||
// ****** run commands
|
||||
clexec(); |
||||
|
||||
// ****** copy outputs
|
||||
copy_output(foutput); |
||||
|
||||
if (debug >= 1) { |
||||
te = nanos_since_boot(); |
||||
printf("model exec in %lu us\n", (te-tb)/1000); |
||||
} |
||||
} |
||||
|
||||
void Thneed::stop() { |
||||
} |
||||
|
||||
void Thneed::find_inputs_outputs() { |
||||
// thneed on PC doesn't work on old style inputs/outputs
|
||||
} |
||||
|
@ -1 +1 @@ |
||||
ca90e11f8d59902af38d3785ddd91a27d0fbb411 |
||||
cffb4e720b0379bedd4ff802912d998ace775c37 |
||||
|
@ -0,0 +1 @@ |
||||
Subproject commit 2e9b7637b3c3c8895fda9f964215db3a35fe3441 |
Loading…
Reference in new issue