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
Merge requests
!332
Add experimental half precison support
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Add experimental half precison support
holzer/pystencils:halfP
into
master
Overview
21
Commits
15
Pipelines
15
Changes
2
Merged
Markus Holzer
requested to merge
holzer/pystencils:halfP
into
master
1 year ago
Overview
21
Commits
15
Pipelines
15
Changes
2
Expand
With this MR experimental half-precision support is added
0
0
Merge request reports
Viewing commit
533afcdf
Prev
Next
Show latest version
2 files
+
22
−
3
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
533afcdf
Add more warnings and tests
· 533afcdf
Markus Holzer
authored
1 year ago
pystencils/cpu/cpujit.py
+
10
−
0
Options
@@ -50,6 +50,7 @@ import platform
import
shutil
import
subprocess
import
textwrap
import
warnings
from
collections
import
OrderedDict
from
sysconfig
import
get_paths
from
tempfile
import
TemporaryDirectory
,
NamedTemporaryFile
@@ -522,6 +523,15 @@ class ExtensionModuleCode:
for
ast
in
self
.
_ast_nodes
:
for
field
in
ast
.
fields_accessed
:
if
isinstance
(
field
.
dtype
,
BasicType
)
and
field
.
dtype
.
is_half
():
if
not
platform
.
machine
()
in
[
'
arm64
'
,
'
aarch64
'
]:
warnings
.
warn
(
f
"
The AST contains half precision data types but platform is:
"
f
"
{
platform
.
machine
()
}
. Using half precision might not work properly on this
"
f
"
platform
"
)
if
'
clang
'
not
in
get_compiler_config
()[
'
command
'
]:
warnings
.
warn
(
f
"
The AST contains half precision data types but compiler is:
"
f
"
{
get_compiler_config
()[
'
command
'
]
}
. Using half precision is only tested with
"
f
"
the Clang compiler
"
)
# Add the half precision header only if half precision numbers occur in the AST
headers
.
add
(
'"
half_precision.h
"'
)
headers
.
update
(
get_headers
(
ast
))
Loading