mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-06-13 08:28:55 +08:00
add windows test to ci (#8761)
Co-authored-by: b1tg <b1tg@users.noreply.github.com>
This commit is contained in:
38
.github/workflows/test.yml
vendored
38
.github/workflows/test.yml
vendored
@@ -619,6 +619,44 @@ jobs:
|
||||
if: matrix.backend=='amd'
|
||||
run: python -m pytest -n=auto test/test_hcq.py test/test_tiny.py --durations=20
|
||||
|
||||
wintests:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
backend: [llvm]
|
||||
|
||||
name: Tests on Windows (${{ matrix.backend }})
|
||||
runs-on: windows-latest
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 2 # NOTE: this fetches the HEAD commit of the PR
|
||||
- name: Set up Python 3.12
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.12
|
||||
- name: Cache python packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.Python3_ROOT_DIR }}\Lib\site-packages
|
||||
key: windows-${{ matrix.backend }}-packages-${{ hashFiles('**/setup.py') }}
|
||||
- name: Install dependencies
|
||||
run: pip install --user -e '.[testing]' --extra-index-url https://download.pytorch.org/whl/cpu
|
||||
- name: Check Device.DEFAULT and print some source
|
||||
env:
|
||||
DEBUG: 5
|
||||
LLVM: 1
|
||||
PYTHONPATH: ${{ github.workspace }}
|
||||
run: |
|
||||
python3 test/test_ops.py TestOps.test_add
|
||||
- name: Run pytest
|
||||
env:
|
||||
DEBUG: 5
|
||||
LLVM: 1
|
||||
run: python -m pytest -n=auto test/test_tiny.py --durations=20
|
||||
|
||||
#testunicorn:
|
||||
# name: ARM64 unicorn Test
|
||||
# runs-on: ubuntu-latest
|
||||
|
||||
@@ -3,7 +3,6 @@ from dataclasses import dataclass, replace
|
||||
from collections import defaultdict
|
||||
from typing import Optional, Any, Iterator, Generator
|
||||
import multiprocessing, importlib, inspect, functools, pathlib, os, ctypes, ctypes.util, platform, contextlib, sys, re, atexit, pickle, decimal, time
|
||||
from mmap import mmap, PROT_READ, PROT_WRITE, PROT_EXEC, MAP_ANON, MAP_PRIVATE
|
||||
from tinygrad.helpers import CI, OSX, LRU, getenv, diskcache_get, diskcache_put, DEBUG, GlobalCounters, flat_mv, from_mv, PROFILE, temp, mv_address, \
|
||||
cpu_time_execution, colored, Context
|
||||
from tinygrad.dtype import DType, ImageDType, PtrDType, dtypes
|
||||
@@ -221,9 +220,10 @@ MAP_JIT = 0x0800
|
||||
|
||||
# CPUProgram is a jit/shellcode program that can be just mmapped and jumped to
|
||||
class CPUProgram:
|
||||
helper_handle = ctypes.CDLL(ctypes.util.find_library('System') if OSX else 'libgcc_s.so.1')
|
||||
|
||||
helper_handle = ctypes.CDLL(ctypes.util.find_library('System' if OSX else 'kernel32' if sys.platform == "win32" else 'gcc_s'))
|
||||
def __init__(self, name:str, lib:bytes):
|
||||
assert sys.platform != "win32", "clang is not supported for windows yet"
|
||||
from mmap import mmap, PROT_READ, PROT_WRITE, PROT_EXEC, MAP_ANON, MAP_PRIVATE
|
||||
# On apple silicon with SPRR enabled (it always is in macos) RWX pages are unrepresentable: https://blog.svenpeter.dev/posts/m1_sprr_gxf/
|
||||
# MAP_JIT allows us to easily flip pages from RW- to R-X and vice versa. It is a noop on intel cpus. (man pthread_jit_write_protect_np)
|
||||
self.mem = mmap(-1, len(lib), MAP_ANON | MAP_PRIVATE | (MAP_JIT if OSX else 0), PROT_READ | PROT_WRITE | PROT_EXEC)
|
||||
@@ -329,4 +329,4 @@ if __name__ == "__main__":
|
||||
result = f"{colored('FAIL', 'yellow')} {e}"
|
||||
except Exception as e:
|
||||
result = f"{colored('FAIL', 'red')} {e}"
|
||||
print(f"{'*' if device == Device.DEFAULT else ' '} {device:10s}: {result}")
|
||||
print(f"{'*' if device == Device.DEFAULT else ' '} {device:10s}: {result}")
|
||||
|
||||
Reference in New Issue
Block a user