Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pycodegen
pystencils
Commits
89ed566a
Commit
89ed566a
authored
5 years ago
by
Stephan Seitz
Browse files
Options
Downloads
Patches
Plain Diff
Bugfix: textures should be implemented as textures without changes
parent
9f76ea1d
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!73
Bugfix: textures should be implemented as textures without changes
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pystencils/interpolation_astnodes.py
+14
-6
14 additions, 6 deletions
pystencils/interpolation_astnodes.py
with
14 additions
and
6 deletions
pystencils/interpolation_astnodes.py
+
14
−
6
View file @
89ed566a
...
...
@@ -12,12 +12,11 @@ import itertools
from
enum
import
Enum
from
typing
import
Set
import
sympy
as
sp
from
sympy.core.cache
import
cacheit
import
pystencils
import
sympy
as
sp
from
pystencils.astnodes
import
Node
from
pystencils.data_types
import
TypedSymbol
,
cast_func
,
create_type
from
sympy.core.cache
import
cacheit
try
:
import
pycuda.driver
...
...
@@ -304,18 +303,19 @@ class TextureCachedField:
self
.
filter_mode
=
filter_mode
self
.
read_as_integer
=
read_as_integer
self
.
use_normalized_coordinates
=
use_normalized_coordinates
self
.
interpolation_mode
=
interpolation_mode
self
.
symbol
=
TypedSymbol
(
str
(
self
),
self
.
field
.
dtype
.
numpy_dtype
)
self
.
symbol
.
interpolator
=
self
self
.
symbol
.
field
=
self
.
field
self
.
required_global_declarations
=
[
TextureDeclaration
(
self
)]
self
.
interpolation_mode
=
interpolation_mode
# assert str(self.field.dtype) != 'double', "CUDA does not support double textures!"
# assert dtype_supports_textures(self.field.dtype), "CUDA only supports texture types with 32 bits or less"
@classmethod
def
from_interpolator
(
cls
,
interpolator
:
LinearInterpolator
):
if
hasattr
(
interpolator
,
'
allow_textures
'
)
and
not
interpolator
.
allow_textures
:
if
(
isinstance
(
interpolator
,
cls
)
or
(
hasattr
(
interpolator
,
'
allow_textures
'
)
and
not
interpolator
.
allow_textures
)):
return
interpolator
obj
=
cls
(
interpolator
.
field
,
interpolator
.
address_mode
,
interpolation_mode
=
interpolator
.
interpolation_mode
)
return
obj
...
...
@@ -327,11 +327,19 @@ class TextureCachedField:
return
TextureAccess
(
self
.
symbol
,
*
offset
)
def
__str__
(
self
):
return
'
%s_texture_%x
'
%
(
self
.
field
.
name
,
abs
(
hash
(
self
.
field
)
+
hash
(
str
(
self
.
address_mode
)
)))
return
'
%s_texture_%x
'
%
(
self
.
field
.
name
,
abs
(
hash
(
self
)))
def
__repr__
(
self
):
return
self
.
__str__
()
def
__hash__
(
self
):
return
hash
((
str
(
type
(
self
)),
self
.
address_mode
,
self
.
filter_mode
,
self
.
read_as_integer
,
self
.
interpolation_mode
,
self
.
use_normalized_coordinates
))
class
TextureAccess
(
InterpolatorAccess
):
def
__new__
(
cls
,
texture_symbol
,
offsets
,
*
args
,
**
kwargs
):
...
...
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