Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
74a7ef7f
Commit
74a7ef7f
authored
Aug 07, 2018
by
Jaikrishnan Menon
Committed by
Scott Cyphers
Aug 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add helper macros to select from a partial set of ranks and element types (#1339)
parent
49d15902
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
1 deletion
+46
-1
cpu_builder.hpp
src/ngraph/runtime/cpu/cpu_builder.hpp
+46
-1
No files found.
src/ngraph/runtime/cpu/cpu_builder.hpp
View file @
74a7ef7f
...
...
@@ -108,7 +108,9 @@
else if (R == 15) \
KV = K<ET, 15>; \
else if (R == 16) \
KV = K<ET, 16>;
KV = K<ET, 16>; \
else \
throw ngraph_error("Unsupported rank " #R " for kernel " #K);
// Per-type and rank kernel macro
#define SELECT_KERNEL_BY_RANK(KV, ET, R, K) \
...
...
@@ -155,6 +157,49 @@
else if (ET == element::u64) \
{ \
SELECT_RANK(KV, uint64_t, R, K); \
} \
else \
{ \
throw ngraph_error("Unsupported element type " + ET.c_type_string() + " for kernel " #K); \
}
// Helper macros for a partial set of element types and ranks
// Useful for keeping compilation time and memory usage reasonable
// when the computed expression is complex
#define PARTIAL_SELECT_RANK(KV, ET, R, K) \
if (R == 1) \
KV = K<ET, 1>; \
else if (R == 2) \
KV = K<ET, 2>; \
else if (R == 3) \
KV = K<ET, 3>; \
else if (R == 4) \
KV = K<ET, 4>; \
else if (R == 5) \
KV = K<ET, 5>; \
else if (R == 6) \
KV = K<ET, 6>; \
else \
throw ngraph_error("Unsupported rank " #R " for kernel " #K);
// Partial per-type and rank kernel macro
#define PARTIAL_SELECT_KERNEL_BY_RANK(KV, ET, R, K) \
if (ET == element::f32) \
{ \
PARTIAL_SELECT_RANK(KV, float, R, K); \
} \
else if (ET == element::i8) \
{ \
PARTIAL_SELECT_RANK(KV, int8_t, R, K); \
} \
else if (ET == element::u8) \
{ \
PARTIAL_SELECT_RANK(KV, uint8_t, R, K); \
} \
else \
{ \
throw ngraph_error("Unsupported element type " + ET.c_type_string() + " for kernel " #K); \
}
#define BUILD_UNARY_ELEMWISE_FUNCTOR(OP) \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment