77a8919349
* UV+DTR model * DTR model.. again. * fix naviGPS * fix radar... * fix.. * test * fix.. * carrot serv * fix.. * fix.. fleet * fix.. radar * fix atc * Steam Powered model.. * fix.. radarLatFactor range.. 200->500 * fix.. dbc.. * side * SP v2 * brake light * fix brakelight * fix.. * add datetime... * fix.. * fix.. * fix.. * fix.. * blind spot * fix tz * fix.. * ff * radarLatFactor * fix.. bsd * Revert "fix.. bsd" This reverts commit 1d0d1434470e1b92c65eaffaeb8dd7cd779f85ee. * fix.. bsd side.. * test * fix.. e2e conditions * Revert "test" This reverts commit 0ce791dbd66c17260366ed1a4df2626c602dbb7d. * TR16 * fix cut-in detect threshold 3.4 -> 2.6 * fix.. jerk_l limit 5->10 * fix.. * fix.. gm * fix.. OPTIMA_H mass * fix.. radar.. * fix radar.. * fix.. * Radar... * fix.. * fix.. * fix.. * fix.. radartrack 3 * fix.. * fix.. * fix.. * merge.. * fix.. canfd * fix.. * fix.. * fix.. * fix.. radard * new cut_in * Revert "new cut_in" This reverts commit b9b6e9b33318fe1ce7d626468139b17848efcdcd. * fix.. * new cut_in detect... * fix.. disp.. * fix.. * fix.. * fix.. center radar.. * fix.. radar y_sane.. * fix.. * fix.. * hkg jerk 10 -> 5 * fix.. * fix.. * fix.. radar dbc.. * fix.. * fix.. jLead filter.. * test new radar interface.. * fix.. * fix.. * test time... * Revert "test time..." This reverts commit 63e9187736985c4dc4b4f3736674ba7cda6adc3f. * fix radar.. * fix.. * FireHose model.. * tinygrad * Update interface.py * fix.. * fix.. nff toyota corolla_tss2 * fix.. * fix.. * fix.. radar * fix.. * fix.. radar, y_gate * fix.. radar.. * fix.. for clone.. * scc radar enable at low speed.. * fix.. settings.. * fix. * fix.. * fix.. radarTimeStep. * TR16 model again.. * RELEASE.md * fix cut-in detection... * fix.. registeration timeout 15sec.. * fix.. * fix.. radar processing. * fix.. * fix.. * fix.. * fix.. * fix.. * fix..
43 lines
1.5 KiB
Python
43 lines
1.5 KiB
Python
import random
|
|
from tinygrad.helpers import getenv
|
|
from tinygrad.codegen.opt.search import beam_search, bufs_from_lin
|
|
from tinygrad.codegen.opt.heuristic import hand_coded_optimizations
|
|
from extra.optimization.helpers import load_worlds, ast_str_to_lin, time_linearizer
|
|
|
|
def optimize_kernel(k):
|
|
# TODO: update this
|
|
return hand_coded_optimizations(k)
|
|
|
|
if __name__ == '__main__':
|
|
hcopt_wins = beam_wins = tie = 0
|
|
hcopt_total = beam_total = 0.0
|
|
|
|
worlds = load_worlds(filter_reduce=False, filter_noimage=True, filter_novariable=False)
|
|
random.seed(0)
|
|
random.shuffle(worlds)
|
|
|
|
for world in worlds[:500]:
|
|
k = ast_str_to_lin(world)
|
|
rawbufs = bufs_from_lin(k)
|
|
|
|
k_hcopt = k.copy()
|
|
k_hcopt.apply_opts(optimize_kernel(k_hcopt))
|
|
k_beam = beam_search(k.copy(), rawbufs, getenv("BEAM", 2))
|
|
|
|
disable_cache = bool(getenv("NOCACHE", 0))
|
|
t_hcopt = time_linearizer(k_hcopt, rawbufs, allow_test_size=False, cnt=10, disable_cache=disable_cache, clear_l2=True) * 1e6
|
|
t_beam = time_linearizer(k_beam, rawbufs, allow_test_size=False, cnt=10, disable_cache=disable_cache, clear_l2=True) * 1e6
|
|
|
|
if t_hcopt == t_beam: tie += 1
|
|
elif t_hcopt < t_beam: hcopt_wins += 1
|
|
else: beam_wins += 1
|
|
hcopt_total += t_hcopt
|
|
beam_total += t_beam
|
|
|
|
print(f"{t_hcopt=:5.2f} {k_hcopt.applied_opts=}")
|
|
print("")
|
|
print(f"{t_beam=:5.2f} {k_beam.applied_opts=}")
|
|
print("*"*20)
|
|
|
|
print(f"{hcopt_wins=}, {beam_wins=}, {tie=}")
|
|
print(f"{hcopt_total=:.2f}, {beam_total=:.2f}") |