Commit Graph
78 Commits
Author SHA1 Message Date
George HotzandGitHub dd41f3ee40 compact the global dimensions using the shapetracker (#897) 2023-06-01 13:09:54 -07:00
JoqsanandGitHub ef129bcb85 Zero dim Tensor support (#777)
* add and reorganize test_slice_* tests

* refactor Tensor.__getitem__()

* preliminary tests for 1) 0D tensors and 2) varargs for Tensor.zeros and Tensor.ones

* always compare shapes of the numpy arrays obtained from tinygrad and torch tensors

* add more tests for 0D support

* remove test_tensor.test_slicing(). All slicing tests at test/test_ops.py

* add zero-dim support

* make test_end2end.py consistent with 0dim support

* add test for tensor with zero in shape

* don't simplify ones if shape is ()

* skip tests that need zero-size tensor support.

- zero-size tensor support not related to 0dim tensors.

* add tests for __getitem__() supporting strides >= 1

* refactor __getitem__: support for strides >= 1

* minor refactors and add comments to __getitem__

* add tests for slices with negative steps

* add support for slices with negative strides
2023-06-01 11:32:02 -07:00
DiogoandGitHub 1272d8526a Llvm int support (#866)
* added int val support to llvm

* lint fix

* added types

* fix merge issues
2023-05-30 17:49:26 -07:00
DiogoandGitHub 0dab8edc97 support Int64 type in cstyle gen (#860)
* added metal int64 and some simple tests

* removed bool return type def

* typo in test

* also missing in clang and gpu runtimes

* switched order for opencl

* increased atol and removed new line in kernel prefix
2023-05-30 16:04:46 -07:00
DiogoandGitHub 1a5d72f812 Onnx ops And, Or, Xor, Not (#847)
* onnx and, or, xor, not

* added bool type to llvm and clang

* removed float conversion

* switched where op to use tensor func
2023-05-29 11:09:20 -07:00
crthilakrajandGitHub 7925fa58d9 Fix cuda (#836)
* disabled float4 ALU ops for CUDA, small fix to add half_prekernel before kernel_prefix

* added supports_float4_alu option, and disabled for ops_cuda
2023-05-29 07:59:36 -07:00
wozeparrotandGitHub 2fd2fb6380 int8/uint8 support (#837)
* feat: int8 support

* feat: uint8 support

* feat: int8 tests

* fix: fix uint8 on clang

* feat: test casting between int8/uint8/float16/float32

* clean: way cleaner dtype tests

* feat: preprocess_imagenet using the correct dtype

* feat: add test for overflow between uint8 and int8
2023-05-28 23:15:06 -07:00
George HotzandGitHub 65d63f5b40 support folding multiple of 4 into float4 (#808) 2023-05-26 12:17:48 -07:00
George HotzandGitHub 3ddcb5c36f Half4 load (#804)
* support half4 load

* cast to float4

* dead assert
2023-05-25 20:21:15 -07:00
DiogoandGitHub c19ef0fcce Add sin/cos/tan (#794)
* added sin/cos/tan

* fix lint

* added onnx ops support
2023-05-25 09:04:56 -07:00
geohot 0400315078 Revert "ops rdna"
This reverts commit 81a11d891d.
2023-05-21 13:02:18 -07:00
geohot 325a3bf2cf Revert "writing 2"
This reverts commit dddd6c42f0.
2023-05-21 13:02:17 -07:00
geohot dddd6c42f0 writing 2 2023-05-21 12:52:36 -07:00
geohot 81a11d891d ops rdna 2023-05-21 11:45:38 -07:00
George HotzandGitHub ed038ba129 Contract float4 ALU operations (#780)
* wrong expand

* tests passing

* pass lint
2023-05-16 19:03:49 -07:00
George HotzandGitHub 90fff82c8a Rdna (#776)
* assembler maybe

* custom asm

* rdna3 on quiet

* trigger crashes

* fixed notes

* non-fatal rdna2 crash

* Crash4

* improve rdna sniffer

* comments

* improve sniffer

* asm

* 131 TFLOPS RDNA3

* opt simple matmul

* todos
2023-05-16 05:33:57 -07:00
George HotzandGitHub 81aa3e546b exclude GPU on tiny (#766) 2023-05-05 10:07:23 -07:00
geohot 466ffeb04f fast cifar on AMD 2023-05-05 02:10:50 +00:00
George HotzandGitHub 8b7ecd63bb Remove Zeroview (#748)
* no zeroview start

* closer

* stride mask

* st tests pass, delete ZeroView

* byebye zv

* close to working

* not contiguous with mask

* subtract, don't add

* mask on view

* ugh, that shouldn't have been in there

* shape merge

* bugfixes

* fuzzer + 4 fuzzer failures

* fuzzer for symbolic

* more fuzzing and nothing

* that fuzzer doesn't hit either

* fixes padding...ugh

* no more offsets

* working

* rewrite load and store

* all checks

* fix idxs

* progress

* bugfix

* float4_axis

* works

* cleanups

* complex valids_okay
2023-04-17 08:21:46 -07:00
Jan Henrik HøilandandGitHub 4e17d27d09 Fix cuda errors when running llama example (#749) 2023-04-16 13:52:10 -07:00
geohot b99798f08e acc function not needed 2023-03-29 08:03:46 +04:00
George HotzandGitHub 20894991ed good changes from the M1 Tensor Core project (#730)
* good changes

* working except llvm

* llvm types

* nice acc

* archprobe

* lang.float4

* use self.acc for late acc

* fix store bug
2023-03-29 05:11:02 +04:00
geohot 2e18469fd4 clean up display name 2023-03-22 18:32:05 -07:00
geohot 128ca160ac lazy: remove required device 2023-03-20 16:31:45 -07:00
geohot 120d7072bd indexing merge almost works 2023-03-20 16:17:07 -07:00
George HotzandGitHub 06abbbfe7c remove the stupid register class (#721)
* remove the stupid register class

* touchups

* colorful display name
2023-03-20 15:45:12 -07:00
George HotzandGitHub 25287a974e types (#720)
* types

* cleanups

* don't use None, use LocalBuffer

* eh
2023-03-20 12:31:02 -07:00
geohot 9b314c6342 factor uops transformers into functions 2023-03-20 08:19:48 -07:00
George HotzandGitHub 5495c7d64e linearizer! (#714)
* linearizer outputs something

* working ish

* cstyle codegen

* clang mostly works

* fix load valid

* fix numberless loop

* fancy gen

* working

* fix enet compiler

* cleanups

* float4 upcasting

* less lines

* supports_float4

* constant folding

* mulacc

* internet tests flaky in CI

* 90% image support

* fix image generic

* bugs exposed with shapetracker and single view

* new llvm

* use vload, remove OLD

* that's really poorly done

* ending up being more lines
2023-03-19 23:43:49 -07:00
geohot 1012b68f7e finally, some speedups 2023-03-18 18:17:33 -07:00
George HotzandGitHub 902906f909 Fix constant folding (#713)
* fix

* codegen

* contiguous is real

* no bufs_to_delete

* don't assign rawconst

* remove neg and not

* need exec to fix custom function jit
2023-03-18 17:52:46 -07:00
George HotzandGitHub f5467cfedc Devicebufferless (#708)
* runs one metal kernel

* conv2d works

* ops tests are passing

* const folding

* all ops work

* pre commit always passes

* torch works

* working still

* fix graph test

* tests passing

* image almost works

* image conv works

* most images

* fix custom

* fix assignment

* fix compile enet

* clean up comments

* fix realize return value

* include shapetracker in LB repr

* copy should make a copy

* reenable method cache

* fix lna

* dtypes in graph

* forward only for IMAGE=2

* simple realize

* getting close

* fixup new api, it's good except the kernel count

* back to 197 kernels

* tests should pass

* go to a real float

* no type_on_cpu

* fix the docs

* put shapetracker back in it's proper place
2023-03-18 14:40:23 -07:00
George HotzandGitHub 54f499b623 Move rawbuffer (#697)
* move GlobalCounters to helpers

* that's not part of the public api

* move InterpretedBuffer

* remove fromCPU from devicebuffer
2023-03-13 22:30:36 -07:00
geohot aca244194f bufs not none 2023-03-12 23:57:41 -07:00
geohot c594a0a835 fix flip bug, add new unit tests 2023-03-12 23:55:31 -07:00
geohot 153cce0f7e tutorial 2023-03-12 22:31:46 -07:00
geohot dcac618515 stop wasting time with the compiler. tinygrad needs to just jit 2023-03-12 12:08:46 -07:00
geohot 46b49d50bd llvm was using wrong shapetracker 2023-03-12 11:49:03 -07:00
geohot fdde87afda Revert "Revert "late simplify on st""
This reverts commit c8508e359d.
2023-03-12 11:47:44 -07:00
geohot c8508e359d Revert "late simplify on st"
This reverts commit 606550474c.
2023-03-12 11:46:10 -07:00
geohot 606550474c late simplify on st 2023-03-12 11:38:56 -07:00
George HotzandGitHub 15e0b56e39 compile works (#688)
* compile works

* runtimes

* line count

* fix custom, to tg dtype

* meh, that's fine with lazy import
2023-03-12 11:01:25 -07:00
Cyril RoumégousandGitHub 3f08613a2a apply flake8 E203 rule (#684) 2023-03-11 11:35:16 -08:00
geohot fd65edf595 fix mem_estimate for dtype.itemsize 2023-03-11 09:20:05 -08:00
geohot 01f39b19dc move to shapetracker.py 2023-03-11 07:50:07 -08:00
George HotzandGitHub f3ac52aee8 Mypyc (#680)
* building shapetracker

* default ENABLE_METHOD_CACHE

* symbolic compiles

* improve types

* tensor compiles

* oops, that's a bug

* best of both worlds

* find legit typing bugs

* pad2d can take list or tuple

* sub 200ms when compiled
2023-03-11 07:33:30 -08:00
George HotzandGitHub 0b03216cc3 losing lines (#678)
* losing lines

* FLIP -> STRIDE

* shapetracker refactor
2023-03-10 21:57:05 -08:00
geohot 8bf75a7fdd fix stable diffusion and CI 2023-03-10 17:48:12 -08:00
geohot c7d17c25d9 ugh, that's getting ugle 2023-03-10 17:41:19 -08:00
geohot 4780f9a6df llama runs (slowly) in master 2023-03-10 17:36:51 -08:00