Loading...
Searching...
No Matches
PrefetchDirective.h
Go to the documentation of this file.
#ifndef HALIDE_PREFETCH_DIRECTIVE_H
#define HALIDE_PREFETCH_DIRECTIVE_H
/** \file
* Defines the PrefetchDirective struct
*/
#include <string>
#include "Expr.h"
#include "Parameter.h"
namespace Halide {
/** Different ways to handle accesses outside the original extents in a prefetch. */
enum class PrefetchBoundStrategy {
/** Clamp the prefetched exprs by intersecting the prefetched region with
* the original extents. This may make the exprs of the prefetched region
* more complicated. */
Clamp,
/** Guard the prefetch with if-guards that ignores the prefetch if
* any of the prefetched region ever goes beyond the original extents
* (i.e. all or nothing). */
GuardWithIf,
/** Leave the prefetched exprs as-is (no if-guards around the prefetch
* and no intersecting with the original extents). This makes the prefetch
* exprs simpler but this may cause prefetching of the region outside the original
* extents. This is good if prefetch won't fault when accessing region
* outside the original extents. */
NonFaulting
};
namespace Internal {
struct PrefetchDirective {
std::string name;
std::string at; // the loop in which to do the prefetch
std::string from; // the loop-var to use as the base for prefetching. It must be nested outside loop_var (or be equal to loop_var).
Expr offset; // 'from + offset' will determine the bounds being prefetched.
PrefetchBoundStrategy strategy;
// If it's a prefetch load from an image parameter, this points to that.
Parameter param;
};
} // namespace Internal
} // namespace Halide
#endif // HALIDE_PREFETCH_DIRECTIVE_H
Expr.h
Base classes for Halide expressions (Halide::Expr) and statements (Halide::Internal::Stmt).
Parameter.h
Defines the internal representation of parameters to halide piplines.
Halide::Parameter
A reference-counted handle to a parameter to a halide pipeline.
Definition Parameter.h:40
Halide
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
Definition AbstractGenerator.h:19
Halide::PrefetchBoundStrategy
PrefetchBoundStrategy
Different ways to handle accesses outside the original extents in a prefetch.
Definition PrefetchDirective.h:16
Halide::PrefetchBoundStrategy::Clamp
@ Clamp
Clamp the prefetched exprs by intersecting the prefetched region with the original extents.
Definition PrefetchDirective.h:20
Halide::PrefetchBoundStrategy::GuardWithIf
@ GuardWithIf
Guard the prefetch with if-guards that ignores the prefetch if any of the prefetched region ever goes...
Definition PrefetchDirective.h:25
Halide::PrefetchBoundStrategy::NonFaulting
@ NonFaulting
Leave the prefetched exprs as-is (no if-guards around the prefetch and no intersecting with the origi...
Definition PrefetchDirective.h:32
Halide::Expr
A fragment of Halide syntax.
Definition Expr.h:258
Halide::Internal::PrefetchDirective
Definition PrefetchDirective.h:37
Halide::Internal::PrefetchDirective::at
std::string at
Definition PrefetchDirective.h:39
Halide::Internal::PrefetchDirective::name
std::string name
Definition PrefetchDirective.h:38
Halide::Internal::PrefetchDirective::from
std::string from
Definition PrefetchDirective.h:40
Halide::Internal::PrefetchDirective::offset
Expr offset
Definition PrefetchDirective.h:41
Halide::Internal::PrefetchDirective::param
Parameter param
Definition PrefetchDirective.h:44
Halide::Internal::PrefetchDirective::strategy
PrefetchBoundStrategy strategy
Definition PrefetchDirective.h:42