mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-16 06:42:12 +08:00
29cd51b876
* 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> old-commit-hash: 40d6f4b65c3776ffd78b3c3285dc5532a802c423
41 lines
843 B
C++
41 lines
843 B
C++
#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
|
|
}
|
|
|