Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
loopy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kaushik Kulkarni
loopy
Commits
fa3d3d66
Commit
fa3d3d66
authored
9 years ago
by
Lucas Wilcox
Browse files
Options
Downloads
Patches
Plain Diff
CUDA target: generate launch bounds, extern C
parent
405c789e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
loopy/target/cuda.py
+20
-2
20 additions, 2 deletions
loopy/target/cuda.py
with
20 additions
and
2 deletions
loopy/target/cuda.py
+
20
−
2
View file @
fa3d3d66
...
@@ -138,6 +138,13 @@ def cuda_function_mangler(kernel, name, arg_dtypes):
...
@@ -138,6 +138,13 @@ def cuda_function_mangler(kernel, name, arg_dtypes):
# {{{ target
# {{{ target
class
CudaTarget
(
CTarget
):
class
CudaTarget
(
CTarget
):
def
__init__
(
self
,
extern_c
=
True
):
"""
:arg extern_c: If *True*, declare kernels using
"
extern C
"
to
avoid name mangling.
"""
self
.
extern_c
=
extern_c
# {{{ library
# {{{ library
def
function_manglers
(
self
):
def
function_manglers
(
self
):
...
@@ -173,8 +180,19 @@ class CudaTarget(CTarget):
...
@@ -173,8 +180,19 @@ class CudaTarget(CTarget):
# {{{ top-level codegen
# {{{ top-level codegen
def
wrap_function_declaration
(
self
,
kernel
,
fdecl
):
def
wrap_function_declaration
(
self
,
kernel
,
fdecl
):
from
cgen.cuda
import
CudaGlobal
from
cgen.cuda
import
CudaGlobal
,
CudaLaunchBounds
return
CudaGlobal
(
fdecl
)
fdecl
=
CudaGlobal
(
fdecl
)
if
self
.
extern_c
:
from
cgen
import
Extern
fdecl
=
Extern
(
"
C
"
,
fdecl
)
_
,
local_grid_size
=
kernel
.
get_grid_sizes_as_exprs
()
from
pytools
import
product
nthreads
=
product
(
local_grid_size
)
return
CudaLaunchBounds
(
nthreads
,
fdecl
)
def
generate_code
(
self
,
kernel
,
codegen_state
,
impl_arg_info
):
def
generate_code
(
self
,
kernel
,
codegen_state
,
impl_arg_info
):
code
,
implemented_domains
=
(
code
,
implemented_domains
=
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment