mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-04-29 03:00:14 -04:00
hcqfuzz: init (#10049)
* hcqfuzz: init * fix fuzz * linter * graph * taht test * update readme
This commit is contained in:
2
test/external/external_fuzz_hcq_signals.py
vendored
2
test/external/external_fuzz_hcq_signals.py
vendored
@@ -24,7 +24,7 @@ def main():
|
||||
dev.timeline_value += 1
|
||||
|
||||
if sync:=random.randint(0, 10) < 3: dev.synchronize()
|
||||
if DEBUG >= 2: print(f"{i}: {q_t.__name__} {dev.device_id} timeline {dev.timeline_value}, wait for {[d.device_id for d in wait_devs]}, {sync=}")
|
||||
if DEBUG >= 2: print(f"{i}: {q_t} {dev.device_id} timeline {dev.timeline_value}, wait for {[d.device_id for d in wait_devs]}, {sync=}")
|
||||
elif i % 100 == 0: print(f"\rCompleted {i} iterations", end='')
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
7
test/external/external_fuzz_tlsf.py
vendored
7
test/external/external_fuzz_tlsf.py
vendored
@@ -1,6 +1,6 @@
|
||||
import random
|
||||
from typing import Dict, Optional
|
||||
|
||||
from tinygrad.helpers import getenv
|
||||
from tinygrad.runtime.support.allocator import TLSFAllocator
|
||||
|
||||
class AllocatorFuzzer:
|
||||
@@ -62,7 +62,7 @@ class AllocatorFuzzer:
|
||||
return True
|
||||
|
||||
def run(self):
|
||||
for i in range(10000000):
|
||||
for i in range(getenv("ITERS", 100000)):
|
||||
if (random.random() < self.alloc_probability or not self.allocations): self.random_alloc()
|
||||
else: self.random_free()
|
||||
|
||||
@@ -72,5 +72,8 @@ class AllocatorFuzzer:
|
||||
print("Fuzzing completed successfully!")
|
||||
|
||||
if __name__ == "__main__":
|
||||
SEED = getenv("SEED", 42)
|
||||
random.seed(SEED)
|
||||
|
||||
fuzzer = AllocatorFuzzer(1 << 30)
|
||||
fuzzer.run()
|
||||
|
||||
2
test/external/fuzz_graph.py
vendored
2
test/external/fuzz_graph.py
vendored
@@ -121,7 +121,7 @@ if __name__ == "__main__":
|
||||
np.random.seed(SEED)
|
||||
|
||||
next_graph_id = 0
|
||||
while True:
|
||||
for i in range(getenv("ITERS", 1000)):
|
||||
print("Running graph", next_graph_id)
|
||||
jis, all_buffers, input_buffers = gen_graph()
|
||||
fuzz_graph(jis, all_buffers, input_buffers)
|
||||
|
||||
Reference in New Issue
Block a user