Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move copy kernel to out of schedule ordering #4530

Merged
merged 2 commits into from May 11, 2024

Conversation

Qazalin
Copy link
Collaborator

@Qazalin Qazalin commented May 11, 2024

@geohot I think the scheduler should create the correct AST in the DAG transformation part.

Copy link
Contributor

Changes

Name                           Lines    Diff    Tokens/Line    Diff
---------------------------  -------  ------  -------------  ------
tinygrad/engine/schedule.py      230      +0           14.6    +0.0


total lines changes: 0

@Qazalin
Copy link
Collaborator Author

Qazalin commented May 11, 2024

ran this with USE_COPY_KERNEL=1

import numpy as np
from tinygrad import Tensor
from tinygrad.engine.realize import run_schedule
from tinygrad.engine.schedule import create_schedule

a = Tensor.randn(4, 4, device="HSA:1").realize()
c = Tensor.ones((4, 4), device="HSA:1").contiguous().realize()
b = a.lazydata._copy("HSA:2")
#b = c.lazydata._copy("HSA:2")
sched = create_schedule([b])
run_schedule(sched.copy())
np.testing.assert_equal(np.frombuffer(a.lazydata.buffer.as_buffer(), a.dtype.np), np.frombuffer(b.buffer.as_buffer(), b.dtype.np))

to test. Would be great if we can have CI.

@Qazalin Qazalin merged commit 4871476 into tinygrad:master May 11, 2024
15 checks passed
@Qazalin Qazalin deleted the copy_kernel branch May 11, 2024 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant