Commit Graph

62 Commits

Author SHA1 Message Date
YassineYousfi cad17b1255
modeld: parsing and publishing in python (#30273)
* WIP try modeld all in python

* fix plan

* add lane lines stds

* fix lane lines prob

* add lead prob

* add meta

* simplify plan parsing

* add hard brake pred

* add confidence

* fix desire state and desire pred

* check this file for now

* rm prints

* rm debug

* add todos

* add plan_t_idxs

* same as cpp

* removed cython

* add wfd width - rm cpp code

* add new files rm old files

* get metadata at compile time

* forgot this file

* now uses more CPU

* not used

* update readme

* lint

* copy this too

* simplify disengage probs

* update model replay ref commit

* update again

* confidence: remove if statemens

* use publish_state.enqueue

* Revert "use publish_state.enqueue"

This reverts commit d8807c8348338a1f773a8de00fd796abb8181404.

* confidence: better shape defs

* use ModelConstants class

* fix confidence

* Parser

* slightly more power too

* no inline ifs :(

* confidence: just use if statements
2023-10-19 14:23:51 -07:00
mitchellgoffpc a184d40b7a Disable error message in thneed ioctl interceptor to fix pyenv issues 2023-08-24 14:41:04 -07:00
Dean Lee 21da5a216f
cpplint: add filter `build/include_subdir` (#29585) 2023-08-24 15:42:17 +01:00
Dean Lee 5480d32bb5
cpplint: add filter `whitespace/parens` (#29565) 2023-08-23 14:25:05 -07:00
Justin Newberry 7fdd9fc37c
CI: Pylint to ruff (#29294)
* pylint to riff

* pylint to riff

* pylint to riff

* revert more

* undo exclude removal

* exclude tinygrad

* set line length

* pylint exclusions to ruff

* same excludes as old linter

* fix tools QA

* remove unrequired check

* revert linting third_party

* ignore e402
2023-08-09 13:26:54 -07:00
Justin Newberry a91764954b
Revert "CI: pylint to ruff (#29276)" (#29284)
This reverts commit cb31a53d8a.
2023-08-08 14:24:04 -07:00
Justin Newberry cb31a53d8a
CI: pylint to ruff (#29276)
* pylint to riff

* pylint to riff

* pylint to riff

* revert more

* undo exclude removal

* exclude tinygrad
2023-08-08 13:41:30 -07:00
Adeeb Shihadeh b22cadc04d
thneed: cleanup duplicate GPU config (#28487)
Co-authored-by: Comma Device <device@comma.ai>
2023-06-11 13:26:41 -07:00
Adeeb Shihadeh d5101e11ad
modeld: adjust CL priority (#28413) 2023-06-05 17:17:38 -07:00
Adeeb Shihadeh cd8e03d53e
move all third party stuff into third_party/ (#26853)
* mv fastcluster

* move msm_kgsl.h

* camerad include

* update path

* mv pyextra

* fix tici build

* add acados_template to release build

Co-authored-by: Comma Device <device@comma.ai>
2022-12-31 21:00:50 -08:00
HaraldSchafer cb0b7375b7
Rocket Launcher Model (#25963)
* 1456d261-d232-4654-8885-4d9fde883894/440 6b7d7cec-ead8-40f3-86cc-86d52c9b03fe/300

* compute only 9 tokens: 1456d261-d232-4654-8885-4d9fde883894/440 6b7d7cec-ead8-40f3-86cc-86d52c9b03fe/300

* tinygrad: cleanup gather

* 1456d261-d232-4654-8885-4d9fde883894/440 6b7d7cec-ead8-40f3-86cc-86d52c9b03fe/700

* empty commit for tests

* bump tinygrad

* dont use tinygrad matmul for now

* bump tinygrad

* 1456d261-d232-4654-8885-4d9fde883894/440 e63ab895-2222-4abd-a9a5-af86bb70e260/700

* float16 1456d261-d232-4654-8885-4d9fde883894/440 e63ab895-2222-4abd-a9a5-af86bb70e260/700

* increase steer rate cost

* Revert "increase steer rate cost"

This reverts commit 74ce9ab9be7ef17ecfec931f96851b12f37f2336.

* fork tinygrad

* empty commit for tests

* basics

* Kinda works

* new lat

* new tuning

* Move LATMPCN so scons compiles

* Update long weights

* Add tinygrad optim

* Update model ref

* update weights

* Update ref

* Try

* Error message for field ignore

* update model regf

* ref commit

* Fix onnx test

Co-authored-by: Yassine Yousfi <yyousfi1@binghamton.edu>
2022-10-05 21:43:38 -07:00
George Hotz 6c39382d71
modeld: delete unused SNPE stuff after move to tinygrad (#25635)
* delete unused stuff

* remove CL interceptor from thneed since we don't use SNPE anymore

* remove dead files from release

* that's removed

* oops, didn't save
2022-09-01 18:28:20 -07:00
George Hotz 40d6f4b65c
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>
2022-09-01 10:31:14 -07:00
George Hotz b6e355a933
modeld: PC Thneed prereqs (#25615)
* pc thneed prereqs

* ugh, out of date

* that can stay private

* memcpy here is fine in SNPE variant

* release files

* thneed docs don't work anymore. they didn't look too useful

Co-authored-by: Comma Device <device@comma.ai>
2022-08-30 17:57:14 -07:00
HaraldSchafer 041458f632
Falcon Punch Model: turn cutting improvements (#25413)
* simplified change to mpc dynamics

* add jerk pts

* increase jerk cost

* increase jerk pts multipler to master value

* Add final commit

* 1456d261-d232-4654-8885-4d9fde883894/440 ac1a6744-85b0-4ec6-8ba7-608d0717b8f1/750

* some copies are useful

* update model replay ref

* less frames in model replay onnx cpu

* 1456d261-d232-4654-8885-4d9fde883894/440 264b67f5-3f52-4b58-b11f-58dd8aaf08bf/950

* 1456d261-d232-4654-8885-4d9fde883894/440 236fc556-fba3-4255-8ccf-684b22637160/950

* c9d10c64-bea4-41ec-8ca3-d8c886fda172/440 26d73dd2-862a-44ae-bbdd-32cc4f397ad7/900

* Fix couple tests

* Update ref

* Unused for now

* Add lateral factor comment

* Unused variable

Co-authored-by: nuwandavek <vivekaithal44@gmail.com>
Co-authored-by: Bruce Wayne <yassine@comma.ai>
Co-authored-by: Yassine Yousfi <yyousfi1@binghamton.edu>
Co-authored-by: Bruce Wayne <batman@gpu06.internal>
2022-08-12 00:47:59 -07:00
YassineYousfi 3afe7464df
Model file too big: Revert "New model: minor fixes" (#25390)
Revert "New model: minor fixes (#25368)"

This reverts commit 55bf938504.
2022-08-08 12:42:46 -07:00
HaraldSchafer 55bf938504
New model: minor fixes (#25368)
* 1456d261-d232-4654-8885-4d9fde883894/440 ac1a6744-85b0-4ec6-8ba7-608d0717b8f1/750

* some copies are useful

* update model replay ref

* less frames in model replay onnx cpu

Co-authored-by: Bruce Wayne <yassine@comma.ai>
Co-authored-by: Yassine Yousfi <yyousfi1@binghamton.edu>
2022-08-05 17:28:15 -07:00
HaraldSchafer 0e0b5c4e24
Revert "Rocket league model (#24869)" (#24936)
* Revert rocket league

* revert ref commit

* New model ref commit
2022-06-21 12:07:00 -07:00
HaraldSchafer 9283040d84
Rocket league model (#24869)
* dd9a502d-c8e2-4831-b365-804b0ae0739d/600 80041070-d276-4fed-bdb9-0075e5442908/420

* no elementwise op

* 9dabf0fe-2e60-44bf-8d3a-d20a74aca072/600 ae746590-0bb5-4a16-80db-15f02d314f03/300 c4663a12-b499-4c9b-90dd-b169e3948cb1/60

* explicit slice

* some copies are useful

* 1456d261-d232-4654-8885-4d9fde883894/440 c06eba55-1931-4e00-9d63-acad00161be0/700 af2eb6ba-1935-4318-aaf8-868db81a4932/425

* 154f663e-d3e9-4020-ad49-0e640588ebbe/399 badb5e69-504f-4544-a99e-ba75ed204b74/800 08330327-7663-4874-af7a-dcbd2c994ba7/800

* set steer rate cost to 1.0

* smaller temporal size

* Update model reg

* update model ref again

* This did upload somehow

* Update steer rate cost

Co-authored-by: Yassine Yousfi <yyousfi1@binghamton.edu>
2022-06-15 15:29:42 -07:00
Adeeb Shihadeh 1139fe507b
Move selfdrive/hardware/ to system/ (#24725)
* move hardware to system/

* fix mypy
2022-06-11 16:38:24 -07:00
Adeeb Shihadeh cb8885cffb
Merge common/ and selfdrive/common (#24556)
* Merge common/ and selfdrive/common

* fix that

* fix version

* fix unit tests
2022-05-18 14:11:57 -07:00
George Hotz 0fc4b4df98
thneed: add flag to enable optimizer (#24568)
* improve the thneed compiler

* only init thneed if we are using the GPU

Co-authored-by: Comma Device <device@comma.ai>
2022-05-17 17:39:18 -07:00
Adeeb Shihadeh 319f3d1475
move models to selfdrive/modeld/ (#24539)
* move models to selfdrive/modeld/

* two more refs
2022-05-15 17:29:09 -07:00
grekiki 17e33978cd
Mypy fixes for --check-untyped-defs (#24372)
more type fixes
2022-05-12 14:08:11 +02:00
Adeeb Shihadeh 5c48e7bc86
remove comma two support (#24248)
* remove comma two support

* cleanup release files

* little more

* more libs

* no more gralloc

* add snpe back
2022-04-18 17:55:23 -07:00
George Hotz 5c5a56c5e6
thneed: a more sane way of doing record/debug (#23938)
Co-authored-by: Comma Device <device@comma.ai>
2022-03-10 16:33:35 -08:00
George Hotz 8d6f49aecf
model: mse err from 0.02-> 0.000056 (#23891)
* mse err from 0.028070712 -> 5.8073703e-05

* build with weights fixup

* need thneed lib also

* don't break for binaries

* static analysis says i need init

* check the bias

* load_dlc_weights

* nicer scons

* tested scons

* fix static

* pylint issue

* new ref

* a few more asserts

Co-authored-by: Harald Schafer <harald.the.engineer@gmail.com>
2022-03-02 20:52:17 -08:00
George Hotz 825c924c1c
minor cleanups, fix non binary compile (#23882)
Co-authored-by: Comma Device <device@comma.ai>
2022-03-01 16:05:44 -08:00
Adeeb Shihadeh 8a19d9892e
modeld: remove support for small model (#23803)
* modeld: remove support for small model

* use extra
2022-02-28 10:32:39 -08:00
Comma Device 83159a09bf THNEED_DEBUG env var support 2022-02-28 09:30:43 -08:00
Comma Device 2b652605a0 thneed: a few asserts in the optimizer for cases it will fail 2022-02-21 12:08:52 -08:00
George Hotz 2c7542d34e
Refactor convolutions (#23807)
* one conv with defines

* add conv

* building works on C3

* this is num_outputs too, process replay is so useful

Co-authored-by: Comma Device <device@comma.ai>
2022-02-20 11:55:23 -08:00
Willem Melching 85efde269d
bigmodel (#23684)
* Added wide cam vipc client and bigmodel transform logic

* Added wide_frame to ModelState, should still work normally

* Refactored image input into addImage method, should still work normally

* Updated thneed/compile.cc

* Bigmodel, untested: 44f83118-b375-4d4c-ae12-2017124f0cf4/200

* Have to initialize extra buffer in SNPEModel

* Default paramater value in the wrong place I think

* Move USE_EXTRA to SConscript

* New model: 6c34d59a-acc3-4877-84bd-904c10745ba6/250

* move use extra check to runtime, not on C2

* this is always true

* more C2 checks

* log if frames are out of sync

* more logging on no frame

* store in pointer

* print sof

* add sync logic

* log based on sof difference as well

* keep both models

* less assumptions

* define above thneed

* typo

* simplify

* no need for second client is main is already wide

* more comments update

* no optional reference

* more logging to debug lags

* add to release files

* both defines

* New model: 6831a77f-2574-4bfb-8077-79b0972a2771/950

* Path offset no longer relevant

* Remove duplicate execute

* Moved bigmodel back to big_supercombo.dlc

* add wide vipc stream

* Tici must be tici

* Needs state too

* add wide cam support to model replay

* handle syncing better

* ugh, c2

* print that

* handle ecam lag

* skip first one

* so close

* update refs

Co-authored-by: mitchellgoffpc <mitchellgoffpc@gmail.com>
Co-authored-by: Harald Schafer <harald.the.engineer@gmail.com>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
Co-authored-by: Comma Device <device@comma.ai>
2022-02-19 16:06:31 -08:00
George Hotz 90beaebefb
add thneed optimizer (#23772)
* add thneed optimizer

* local work group opt

* kernels and final mods

* release files

* build system touchups

* fix kernel path, rand inputs for self test

* broken since extra is gone

* update model replay ref

Co-authored-by: Comma Device <device@comma.ai>
2022-02-15 15:32:00 -08:00
Willem Melching c2b95ca6a1 util.h has conflicting ioctl def on comma two 2021-11-04 16:46:38 +01:00
Dean Lee 177c3b89b6
thneed/serialize: use funtions from clutil(#22760) 2021-11-04 16:19:25 +01:00
Dean Lee ff33ca3413
util: remove function to_hex (#22792) 2021-11-04 16:18:01 +01:00
Willem Melching 45c506bb17 wshadow: fix comma three build 2021-11-02 17:27:34 +01:00
Dean Lee 07ad6d7444
thneed: use util::read_file to read from the file (#22757) 2021-11-01 11:07:28 +01:00
George Hotz 83ff9ca331
Use thneed directly on the loaded YUV data (#22236)
* completely untested

* it builds now

* bug fixes, save 1ms

* using a kernel to copy works

* more sane API to loadyuv

Co-authored-by: Comma Device <device@comma.ai>
2021-09-16 14:13:03 -07:00
Willem Melching 813ddb0c18 revert ioctl changes to thneed 2021-08-30 16:30:50 -07:00
Dean Lee 31230e5b60
retry ioctls while errno == EINTR (#22054) 2021-08-30 16:07:34 -07:00
arfy slowy d74def61f8
fix: spelling typos (#21861)
* fix: typo spelling grammar

* revert

* Update selfdrive/locationd/calibrationd.py

* more revert

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-08-05 12:05:49 -07:00
Dean Lee d82fa763d8
remove double semicolons (#21215) 2021-06-10 00:03:34 -07:00
Dean Lee c53cb5d570
Use C++ header files instead of C header files. (#21192)
* use cstring instead of string.h

* use cstdio instead of stdio.h

* remove inttypes.h

* use cstdlib instead of stdlib.h

* use cstdint instead of stdint.h

* #include <cstddef>

* cstdlib

* use cmath

* remove stddef.h

* use cassert

* use csignal

* use ctime

* use cerror

* rebase master
2021-06-08 13:46:22 -07:00
Dean Lee 7222d0f20d
Cleanup selfdrive/ includes (#20822)
* cleanup include path

* continue

* format includes

* fix testraw.cc

* remove include path from SConstruct

* regroup

* rebase master

* almost done

* apply review

* rename FileReader.xx to filereader.xx

* rename Unlogger.x->unlogger.x

* rename FrameReader.xx -> framereader.xx

* apply reviews

* ui.h

* continue

* fix framebuffer.cc build error:mv util.h up

* full path to msm_media_info

* fix qcom2 camerad

Co-authored-by: Comma Device <device@comma.ai>
2021-05-08 22:15:17 -07:00
Dean Lee d023397ba9
thneed: remove redundant function nanos_since_boot (#20329) 2021-03-12 10:31:55 -08:00
Willem Melching 1744076514
thneed: lookup dlsym offset at compile time (#20019) 2021-02-04 16:41:46 +01:00
Dean Lee 21f45e3ef4
Thneed::clinit() : use cl_get_device_id helper(#19934) 2021-01-27 12:09:28 +01:00
George Hotz 59fac9fdc6
Thneed load/save (#19700)
* start thneed load/save

* compiling

* fix loading

* build thneed model in scons

* don't hardcode /data/openpilot

* release files

* those too

* support for loading/saving binary kernels

* save binaries out of json band

* make binary a command line flag to the compiler

* need include assert

* fix shadowed common in SConscript

* cleanup run.h

* hmm, the recurrent buffer wasn't 0ed

* ugh, unique ptr

* remove power constraint, refactor record

* Revert "remove power constraint, refactor record"

This reverts commit bb6fa52db6df59cd9d6420a6f630430e35af8a5e.

* print on thneed stop

* fingers crossed for this one

* recorded

* just curious

* okay okay, pass tests?

* cleanups

* refactor wait

Co-authored-by: Comma Device <device@comma.ai>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-01-19 18:08:31 -08:00