
* fix.. speed_limit error... * draw tpms settings. * fix.. traffic light stopping only.. * fix.. waze cam * fix.. waze... * add setting (Enable comma connect ) * auto detect LFA2 * fix.. cruisespeed1 * vff2 driving model. * fix.. * agnos 12.3 * fix.. * ff * ff * test * ff * fix.. drawTurnInfo.. * Update drive_helpers.py * fix.. support eng voice eng sounds fix settings... english fix.. mph.. fix.. roadlimit speed bug.. * new vff model.. 250608 * fix soundd.. * fix safe exit speed.. * fix.. sounds. * fix.. radar timeStep.. * KerryGold model * Update drive_helpers.py * fix.. model. * fix.. * fix.. * Revert "fix.." This reverts commit b09ec459afb855c533d47fd7e8a1a6b1a09466e7. * Revert "fix.." This reverts commit 290bec6b83a4554ca232d531a911edccf94a2156. * fix esim * add more acc table. 10kph * kg update.. * fix cruisebutton mode3 * test atc..cond. * fix.. canfd * fix.. angle control limit
43 lines
1.5 KiB
Python
43 lines
1.5 KiB
Python
import random
|
|
from tinygrad.helpers import getenv
|
|
from tinygrad.engine.search import beam_search, bufs_from_lin
|
|
from tinygrad.codegen.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}") |