Commit 9ce52082 authored by Jesse Natalie's avatar Jesse Natalie Committed by Erik Faye-Lund
Browse files

Revert "nir: Add src/dst alignment info to copy_deref"

This reverts commit 2a40b849.
parent 94a069d9
......@@ -1458,7 +1458,7 @@ typedef struct {
#include "nir_intrinsics.h"
#define NIR_INTRINSIC_MAX_CONST_INDEX 6
#define NIR_INTRINSIC_MAX_CONST_INDEX 4
/** Represents an intrinsic
*
......@@ -1679,12 +1679,6 @@ typedef enum {
NIR_INTRINSIC_SRC_ACCESS,
NIR_INTRINSIC_DST_ACCESS,
/* Separate source/dest align info for copies */
NIR_INTRINSIC_SRC_ALIGN_MUL,
NIR_INTRINSIC_DST_ALIGN_MUL,
NIR_INTRINSIC_SRC_ALIGN_OFFSET,
NIR_INTRINSIC_DST_ALIGN_OFFSET,
/* Driver location for nir_load_patch_location_ir3 */
NIR_INTRINSIC_DRIVER_LOCATION,
......@@ -1812,11 +1806,7 @@ INTRINSIC_IDX_ACCESSORS(src_access, SRC_ACCESS, enum gl_access_qualifier)
INTRINSIC_IDX_ACCESSORS(dst_access, DST_ACCESS, enum gl_access_qualifier)
INTRINSIC_IDX_ACCESSORS(format, FORMAT, enum pipe_format)
INTRINSIC_IDX_ACCESSORS(align_mul, ALIGN_MUL, unsigned)
INTRINSIC_IDX_ACCESSORS(src_align_mul, SRC_ALIGN_MUL, unsigned)
INTRINSIC_IDX_ACCESSORS(dst_align_mul, DST_ALIGN_MUL, unsigned)
INTRINSIC_IDX_ACCESSORS(align_offset, ALIGN_OFFSET, unsigned)
INTRINSIC_IDX_ACCESSORS(src_align_offset, SRC_ALIGN_OFFSET, unsigned)
INTRINSIC_IDX_ACCESSORS(dst_align_offset, DST_ALIGN_OFFSET, unsigned)
INTRINSIC_IDX_ACCESSORS(desc_type, DESC_TYPE, unsigned)
INTRINSIC_IDX_ACCESSORS(type, TYPE, nir_alu_type)
INTRINSIC_IDX_ACCESSORS(swizzle_mask, SWIZZLE_MASK, unsigned)
......@@ -1826,6 +1816,19 @@ INTRINSIC_IDX_ACCESSORS(memory_modes, MEMORY_MODES, nir_variable_mode)
INTRINSIC_IDX_ACCESSORS(memory_scope, MEMORY_SCOPE, nir_scope)
INTRINSIC_IDX_ACCESSORS(execution_scope, EXECUTION_SCOPE, nir_scope)
static inline void
nir_intrinsic_set_align(nir_intrinsic_instr *intrin,
unsigned align_mul, unsigned align_offset)
{
assert(align_mul == 0 || util_is_power_of_two_nonzero(align_mul));
assert(align_mul == 0 ? align_offset == 0 : align_offset < align_mul);
assert(align_mul != 0 ||
intrin->intrinsic == nir_intrinsic_load_deref ||
intrin->intrinsic == nir_intrinsic_store_deref);
nir_intrinsic_set_align_mul(intrin, align_mul);
nir_intrinsic_set_align_offset(intrin, align_offset);
}
/** Returns a simple alignment for a load/store intrinsic offset
*
* Instead of the full mul+offset alignment scheme provided by the ALIGN_MUL
......@@ -1833,35 +1836,15 @@ INTRINSIC_IDX_ACCESSORS(execution_scope, EXECUTION_SCOPE, nir_scope)
* provides a single simple alignment parameter. The offset X is guaranteed
* to satisfy X % align == 0.
*/
#define INTRINSIC_ALIGN_ACCESSORS(name) \
static inline unsigned \
nir_intrinsic_##name(const nir_intrinsic_instr *intrin) \
{ \
const unsigned align_mul = nir_intrinsic_##name##_mul(intrin); \
const unsigned align_offset = nir_intrinsic_##name##_offset(intrin); \
assert(align_mul == 0 ? align_offset == 0 : align_offset < align_mul); \
return align_offset ? 1 << (ffs(align_offset) - 1) : align_mul; \
} \
\
static inline void \
nir_intrinsic_set_##name(nir_intrinsic_instr *intrin, \
unsigned align_mul, unsigned align_offset) \
{ \
assert(align_mul == 0 || util_is_power_of_two_nonzero(align_mul)); \
assert(align_mul == 0 ? align_offset == 0 : align_offset < align_mul); \
assert(align_mul != 0 || \
intrin->intrinsic == nir_intrinsic_load_deref || \
intrin->intrinsic == nir_intrinsic_store_deref || \
intrin->intrinsic == nir_intrinsic_copy_deref); \
nir_intrinsic_set_##name##_mul(intrin, align_mul); \
nir_intrinsic_set_##name##_offset(intrin, align_offset); \
static inline unsigned
nir_intrinsic_align(const nir_intrinsic_instr *intrin)
{
const unsigned align_mul = nir_intrinsic_align_mul(intrin);
const unsigned align_offset = nir_intrinsic_align_offset(intrin);
assert(align_mul == 0 ? align_offset == 0 : align_offset < align_mul);
return align_offset ? 1 << (ffs(align_offset) - 1) : align_mul;
}
INTRINSIC_ALIGN_ACCESSORS(align)
INTRINSIC_ALIGN_ACCESSORS(src_align)
INTRINSIC_ALIGN_ACCESSORS(dst_align)
unsigned
nir_image_intrinsic_coord_components(const nir_intrinsic_instr *instr);
......
......@@ -1242,39 +1242,20 @@ nir_store_deref(nir_builder *build, nir_deref_instr *deref,
}
static inline void
nir_copy_deref_with_access_and_align(nir_builder *build, nir_deref_instr *dest,
nir_deref_instr *src,
enum gl_access_qualifier dest_access,
enum gl_access_qualifier src_access,
unsigned dest_align_mul,
unsigned dest_align_offset,
unsigned src_align_mul,
unsigned src_align_offset)
nir_copy_deref_with_access(nir_builder *build, nir_deref_instr *dest,
nir_deref_instr *src,
enum gl_access_qualifier dest_access,
enum gl_access_qualifier src_access)
{
nir_intrinsic_instr *copy =
nir_intrinsic_instr_create(build->shader, nir_intrinsic_copy_deref);
copy->src[0] = nir_src_for_ssa(&dest->dest.ssa);
copy->src[1] = nir_src_for_ssa(&src->dest.ssa);
nir_intrinsic_set_dst_access(copy, dest_access);
nir_intrinsic_set_dst_align_mul(copy, dest_align_mul);
nir_intrinsic_set_dst_align_offset(copy, dest_align_offset);
nir_intrinsic_set_src_access(copy, src_access);
nir_intrinsic_set_src_align_mul(copy, src_align_mul);
nir_intrinsic_set_src_align_offset(copy, src_align_offset);
nir_builder_instr_insert(build, &copy->instr);
}
static inline void
nir_copy_deref_with_access(nir_builder *build, nir_deref_instr *dest,
nir_deref_instr *src,
enum gl_access_qualifier dest_access,
enum gl_access_qualifier src_access)
{
nir_copy_deref_with_access_and_align(build, dest, src,
dest_access, src_access,
0, 0, 0, 0);
}
static inline void
nir_copy_deref(nir_builder *build, nir_deref_instr *dest, nir_deref_instr *src)
{
......
......@@ -117,11 +117,7 @@ SRC_ACCESS = "NIR_INTRINSIC_SRC_ACCESS"
FORMAT = "NIR_INTRINSIC_FORMAT"
# Offset or address alignment
ALIGN_MUL = "NIR_INTRINSIC_ALIGN_MUL"
SRC_ALIGN_MUL = "NIR_INTRINSIC_SRC_ALIGN_MUL"
DST_ALIGN_MUL = "NIR_INTRINSIC_DST_ALIGN_MUL"
ALIGN_OFFSET = "NIR_INTRINSIC_ALIGN_OFFSET"
SRC_ALIGN_OFFSET = "NIR_INTRINSIC_SRC_ALIGN_OFFSET"
DST_ALIGN_OFFSET = "NIR_INTRINSIC_DST_ALIGN_OFFSET"
# The vulkan descriptor type for vulkan_resource_index
DESC_TYPE = "NIR_INTRINSIC_DESC_TYPE"
# The nir_alu_type of a uniform/input/output
......@@ -172,10 +168,8 @@ intrinsic("load_param", dest_comp=0, indices=[PARAM_IDX], flags=[CAN_ELIMINATE])
intrinsic("load_deref", dest_comp=0, src_comp=[-1],
indices=[ACCESS, ALIGN_MUL, ALIGN_OFFSET], flags=[CAN_ELIMINATE])
intrinsic("store_deref", src_comp=[-1, 0], indices=[WRMASK, ACCESS, ALIGN_MUL, ALIGN_OFFSET])
intrinsic("copy_deref", src_comp=[-1, -1], indices=[DST_ACCESS, DST_ALIGN_MUL, DST_ALIGN_OFFSET,
SRC_ACCESS, SRC_ALIGN_MUL, SRC_ALIGN_OFFSET])
intrinsic("memcpy_deref", src_comp=[-1, -1, 1], indices=[DST_ACCESS, DST_ALIGN_MUL, DST_ALIGN_OFFSET,
SRC_ACCESS, SRC_ALIGN_MUL, SRC_ALIGN_OFFSET])
intrinsic("copy_deref", src_comp=[-1, -1], indices=[DST_ACCESS, SRC_ACCESS])
intrinsic("memcpy_deref", src_comp=[-1, -1, 1], indices=[DST_ACCESS, SRC_ACCESS])
# Interpolation of input. The interp_deref_at* intrinsics are similar to the
# load_var intrinsic acting on a shader input except that they interpolate the
......
......@@ -811,11 +811,7 @@ print_intrinsic_instr(nir_intrinsic_instr *instr, print_state *state)
[NIR_INTRINSIC_DST_ACCESS] = "dst-access",
[NIR_INTRINSIC_FORMAT] = "format",
[NIR_INTRINSIC_ALIGN_MUL] = "align_mul",
[NIR_INTRINSIC_SRC_ALIGN_MUL] = "src_align_mul",
[NIR_INTRINSIC_DST_ALIGN_MUL] = "dst_align_mul",
[NIR_INTRINSIC_ALIGN_OFFSET] = "align_offset",
[NIR_INTRINSIC_SRC_ALIGN_OFFSET] = "src_align_offset",
[NIR_INTRINSIC_DST_ALIGN_OFFSET] = "dst_align_offset",
[NIR_INTRINSIC_DESC_TYPE] = "desc_type",
[NIR_INTRINSIC_TYPE] = "type",
[NIR_INTRINSIC_SWIZZLE_MASK] = "swizzle_mask",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment