Skip to content

Use stacked method tables #325

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Use stacked method tables #325

wants to merge 1 commit into from

Conversation

vchuravy
Copy link
Member

Copy link
Contributor

Your PR requires formatting changes to meet the project's style guidelines.
Please consider running Runic (git runic master) to apply these changes.

Click here to view the suggested changes.
diff --git a/src/OpenCL.jl b/src/OpenCL.jl
index 04c0a99..6efcbb3 100644
--- a/src/OpenCL.jl
+++ b/src/OpenCL.jl
@@ -21,9 +21,11 @@ export cl
 Base.Experimental.@MethodTable(method_table)
 
 macro device_override(ex)
-    esc(quote
-        Base.Experimental.@overlay($method_table, $ex)
-    end)
+    return esc(
+        quote
+            Base.Experimental.@overlay($method_table, $ex)
+        end
+    )
 end
 
 macro device_function(ex)
@@ -35,10 +37,12 @@ macro device_function(ex)
         error("This function is not intended for use on the CPU")
     end
 
-    esc(quote
-        $(ExprTools.combinedef(def))
-        @device_override $ex
-    end)
+    return esc(
+        quote
+            $(ExprTools.combinedef(def))
+            @device_override $ex
+        end
+    )
 end
 
 

@@ -32,6 +32,7 @@ macro import_all()
# bring all the names of this module in scope
name in (:SPIRVIntrinsics, :eval, :include) && continue
startswith(string(name), "#") && continue
name in (:method_table, :@device_function, :@device_override) && continue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😱
That repo is hosted here; just remove the functions from there as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is a good question. Inside SPIRVIntrinsics.jl we will likely want to use device_function and device_override. At least device_function makes sense.

@device_function atomic_add!(p::LLVMPtr{$gentype,$as}, val::$gentype) =

For me that means we shouldn't remove these macros, we could rename them to spirv_function or somemthing similar.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, SPIRVIntrinsics retains its own method table. In that case, I guess we should start marking functions for export (or use the new @public) and only expose those to the importing package.

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.

2 participants