hcqfuzz: init (#10049)

* hcqfuzz: init

* fix fuzz

* linter

* graph

* taht test

* update readme
This commit is contained in:
nimlgen
2025-04-25 23:19:21 +03:00
committed by GitHub
parent b30050e287
commit 0fc85a2b0a
13 changed files with 427 additions and 4 deletions

View File

@@ -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__":

View File

@@ -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()

View File

@@ -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)