2006-08-09 19:14:05 +00:00
|
|
|
/*
|
|
|
|
|
Copyright (C) Intel Corp. 2006. All Rights Reserved.
|
s/Tungsten Graphics/VMware/
Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the
old copyright name is creating unnecessary confusion, hence this change.
This was the sed script I used:
$ cat tg2vmw.sed
# Run as:
#
# git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed
#
# Rename copyrights
s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g
/Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./
s/TUNGSTEN GRAPHICS/VMWARE/g
# Rename emails
s/alanh@tungstengraphics.com/alanh@vmware.com/
s/jens@tungstengraphics.com/jowen@vmware.com/g
s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/
s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g
s/keithw\?@tungstengraphics.com/keithw@vmware.com/g
s/michel@tungstengraphics.com/daenzer@vmware.com/g
s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/
s/zack@tungstengraphics.com/zackr@vmware.com/
# Remove dead links
s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g
# C string src/gallium/state_trackers/vega/api_misc.c
s/"Tungsten Graphics, Inc"/"VMware, Inc"/
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 16:27:50 +00:00
|
|
|
Intel funded Tungsten Graphics to
|
2006-08-09 19:14:05 +00:00
|
|
|
develop this 3D driver.
|
2013-11-25 15:39:03 -08:00
|
|
|
|
2006-08-09 19:14:05 +00:00
|
|
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
|
a copy of this software and associated documentation files (the
|
|
|
|
|
"Software"), to deal in the Software without restriction, including
|
|
|
|
|
without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
|
distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
|
permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
|
the following conditions:
|
2013-11-25 15:39:03 -08:00
|
|
|
|
2006-08-09 19:14:05 +00:00
|
|
|
The above copyright notice and this permission notice (including the
|
|
|
|
|
next paragraph) shall be included in all copies or substantial
|
|
|
|
|
portions of the Software.
|
2013-11-25 15:39:03 -08:00
|
|
|
|
2006-08-09 19:14:05 +00:00
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
|
|
|
IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
|
|
|
|
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
|
|
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
|
|
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
2013-11-25 15:39:03 -08:00
|
|
|
|
2006-08-09 19:14:05 +00:00
|
|
|
**********************************************************************/
|
|
|
|
|
/*
|
|
|
|
|
* Authors:
|
s/Tungsten Graphics/VMware/
Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the
old copyright name is creating unnecessary confusion, hence this change.
This was the sed script I used:
$ cat tg2vmw.sed
# Run as:
#
# git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed
#
# Rename copyrights
s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g
/Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./
s/TUNGSTEN GRAPHICS/VMWARE/g
# Rename emails
s/alanh@tungstengraphics.com/alanh@vmware.com/
s/jens@tungstengraphics.com/jowen@vmware.com/g
s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/
s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g
s/keithw\?@tungstengraphics.com/keithw@vmware.com/g
s/michel@tungstengraphics.com/daenzer@vmware.com/g
s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/
s/zack@tungstengraphics.com/zackr@vmware.com/
# Remove dead links
s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g
# C string src/gallium/state_trackers/vega/api_misc.c
s/"Tungsten Graphics, Inc"/"VMware, Inc"/
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 16:27:50 +00:00
|
|
|
* Keith Whitwell <keithw@vmware.com>
|
2006-08-09 19:14:05 +00:00
|
|
|
*/
|
2013-11-25 15:39:03 -08:00
|
|
|
|
2024-12-06 14:25:29 -08:00
|
|
|
#pragma once
|
2006-08-09 19:14:05 +00:00
|
|
|
|
2010-12-03 11:49:29 -08:00
|
|
|
#include <stdbool.h>
|
2018-04-08 13:13:08 -04:00
|
|
|
#include <stdio.h>
|
2024-12-14 14:36:38 -08:00
|
|
|
#include "brw_eu_inst.h"
|
2020-08-10 11:09:10 -05:00
|
|
|
#include "brw_compiler.h"
|
2017-03-09 00:44:29 +00:00
|
|
|
#include "brw_eu_defines.h"
|
2022-06-29 14:25:19 -07:00
|
|
|
#include "brw_isa_info.h"
|
2012-11-09 14:00:15 -08:00
|
|
|
#include "brw_reg.h"
|
2006-08-09 19:14:05 +00:00
|
|
|
|
2023-08-01 11:02:31 +03:00
|
|
|
#include "intel_wa.h"
|
2021-12-07 16:41:19 +10:00
|
|
|
#include "util/bitset.h"
|
|
|
|
|
|
2012-04-27 07:40:34 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2024-01-24 22:57:44 -08:00
|
|
|
struct disasm_info;
|
|
|
|
|
|
2006-08-09 19:14:05 +00:00
|
|
|
#define BRW_EU_MAX_INSN_STACK 5
|
|
|
|
|
|
2018-05-29 14:37:35 -07:00
|
|
|
struct brw_insn_state {
|
|
|
|
|
/* One of BRW_EXECUTE_* */
|
|
|
|
|
unsigned exec_size:3;
|
|
|
|
|
|
|
|
|
|
/* Group in units of channels */
|
|
|
|
|
unsigned group:5;
|
|
|
|
|
|
|
|
|
|
/* One of BRW_MASK_* */
|
|
|
|
|
unsigned mask_control:1;
|
|
|
|
|
|
2021-03-29 15:46:12 -07:00
|
|
|
/* Scheduling info for Gfx12+ */
|
2018-11-09 14:13:36 -08:00
|
|
|
struct tgl_swsb swsb;
|
|
|
|
|
|
2018-05-29 14:37:35 -07:00
|
|
|
bool saturate:1;
|
|
|
|
|
|
|
|
|
|
/* One of BRW_ALIGN_* */
|
|
|
|
|
unsigned access_mode:1;
|
|
|
|
|
|
|
|
|
|
/* One of BRW_PREDICATE_* */
|
|
|
|
|
enum brw_predicate predicate:4;
|
|
|
|
|
|
|
|
|
|
bool pred_inv:1;
|
|
|
|
|
|
|
|
|
|
/* Flag subreg. Bottom bit is subreg, top bit is reg */
|
|
|
|
|
unsigned flag_subreg:2;
|
|
|
|
|
|
|
|
|
|
bool acc_wr_control:1;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2014-05-27 23:27:01 -07:00
|
|
|
/* A helper for accessing the last instruction emitted. This makes it easy
|
|
|
|
|
* to set various bits on an instruction without having to create temporary
|
|
|
|
|
* variable and assign the emitted instruction to those.
|
|
|
|
|
*/
|
|
|
|
|
#define brw_last_inst (&p->store[p->nr_insn - 1])
|
|
|
|
|
|
2015-04-16 11:06:57 -07:00
|
|
|
struct brw_codegen {
|
2024-12-14 14:44:47 -08:00
|
|
|
brw_eu_inst *store;
|
2011-12-21 15:38:44 +08:00
|
|
|
int store_size;
|
2013-11-25 15:51:24 -08:00
|
|
|
unsigned nr_insn;
|
2012-02-03 11:50:42 +01:00
|
|
|
unsigned int next_insn_offset;
|
2006-08-09 19:14:05 +00:00
|
|
|
|
2011-05-16 11:49:57 -07:00
|
|
|
void *mem_ctx;
|
|
|
|
|
|
2006-08-09 19:14:05 +00:00
|
|
|
/* Allow clients to push/pop instruction state:
|
|
|
|
|
*/
|
2018-05-29 14:37:35 -07:00
|
|
|
struct brw_insn_state stack[BRW_EU_MAX_INSN_STACK];
|
|
|
|
|
struct brw_insn_state *current;
|
2006-08-09 19:14:05 +00:00
|
|
|
|
2022-06-29 14:13:31 -07:00
|
|
|
const struct brw_isa_info *isa;
|
2021-04-05 13:19:39 -07:00
|
|
|
const struct intel_device_info *devinfo;
|
2009-02-13 17:17:52 -07:00
|
|
|
|
2011-05-16 12:25:18 -07:00
|
|
|
/* Control flow stacks:
|
|
|
|
|
* - if_stack contains IF and ELSE instructions which must be patched
|
|
|
|
|
* (and popped) once the matching ENDIF instruction is encountered.
|
2011-12-21 14:51:59 +08:00
|
|
|
*
|
|
|
|
|
* Just store the instruction pointer(an index).
|
2011-05-16 12:25:18 -07:00
|
|
|
*/
|
2011-12-21 14:51:59 +08:00
|
|
|
int *if_stack;
|
2011-05-16 12:25:18 -07:00
|
|
|
int if_stack_depth;
|
|
|
|
|
int if_stack_array_size;
|
|
|
|
|
|
2011-12-06 12:13:32 -08:00
|
|
|
/**
|
|
|
|
|
* loop_stack contains the instruction pointers of the starts of loops which
|
|
|
|
|
* must be patched (and popped) once the matching WHILE instruction is
|
|
|
|
|
* encountered.
|
|
|
|
|
*/
|
|
|
|
|
int *loop_stack;
|
|
|
|
|
int loop_stack_depth;
|
|
|
|
|
int loop_stack_array_size;
|
2020-08-08 12:55:29 -05:00
|
|
|
|
|
|
|
|
struct brw_shader_reloc *relocs;
|
|
|
|
|
int num_relocs;
|
|
|
|
|
int reloc_array_size;
|
2006-08-09 19:14:05 +00:00
|
|
|
};
|
|
|
|
|
|
2019-06-03 12:10:09 +03:00
|
|
|
struct brw_label {
|
|
|
|
|
int offset;
|
|
|
|
|
int number;
|
|
|
|
|
struct brw_label *next;
|
|
|
|
|
};
|
|
|
|
|
|
2015-04-16 11:06:57 -07:00
|
|
|
void brw_pop_insn_state( struct brw_codegen *p );
|
|
|
|
|
void brw_push_insn_state( struct brw_codegen *p );
|
2018-05-29 14:50:46 -07:00
|
|
|
unsigned brw_get_default_exec_size(struct brw_codegen *p);
|
|
|
|
|
unsigned brw_get_default_group(struct brw_codegen *p);
|
|
|
|
|
unsigned brw_get_default_access_mode(struct brw_codegen *p);
|
2018-11-09 14:13:36 -08:00
|
|
|
struct tgl_swsb brw_get_default_swsb(struct brw_codegen *p);
|
2015-04-16 11:06:57 -07:00
|
|
|
void brw_set_default_exec_size(struct brw_codegen *p, unsigned value);
|
|
|
|
|
void brw_set_default_mask_control( struct brw_codegen *p, unsigned value );
|
|
|
|
|
void brw_set_default_saturate( struct brw_codegen *p, bool enable );
|
|
|
|
|
void brw_set_default_access_mode( struct brw_codegen *p, unsigned access_mode );
|
2024-12-06 12:50:23 -08:00
|
|
|
void brw_eu_inst_set_group(const struct intel_device_info *devinfo,
|
2024-12-14 14:44:47 -08:00
|
|
|
brw_eu_inst *inst, unsigned group);
|
2016-05-18 15:29:07 -07:00
|
|
|
void brw_set_default_group(struct brw_codegen *p, unsigned group);
|
2018-06-07 15:32:15 -07:00
|
|
|
void brw_set_default_predicate_control(struct brw_codegen *p, enum brw_predicate pc);
|
2015-04-16 11:06:57 -07:00
|
|
|
void brw_set_default_predicate_inverse(struct brw_codegen *p, bool predicate_inverse);
|
|
|
|
|
void brw_set_default_flag_reg(struct brw_codegen *p, int reg, int subreg);
|
|
|
|
|
void brw_set_default_acc_write_control(struct brw_codegen *p, unsigned value);
|
2018-11-09 14:13:36 -08:00
|
|
|
void brw_set_default_swsb(struct brw_codegen *p, struct tgl_swsb value);
|
2015-04-16 11:06:57 -07:00
|
|
|
|
2022-06-29 14:13:31 -07:00
|
|
|
void brw_init_codegen(const struct brw_isa_info *isa,
|
|
|
|
|
struct brw_codegen *p, void *mem_ctx);
|
2021-04-05 13:19:39 -07:00
|
|
|
bool brw_has_jip(const struct intel_device_info *devinfo, enum opcode opcode);
|
|
|
|
|
bool brw_has_uip(const struct intel_device_info *devinfo, enum opcode opcode);
|
2024-10-19 15:52:55 +03:00
|
|
|
bool brw_has_branch_ctrl(const struct intel_device_info *devinfo, enum opcode opcode);
|
2020-08-08 12:55:29 -05:00
|
|
|
const struct brw_shader_reloc *brw_get_shader_relocs(struct brw_codegen *p,
|
|
|
|
|
unsigned *num_relocs);
|
2015-04-16 11:06:57 -07:00
|
|
|
const unsigned *brw_get_program( struct brw_codegen *p, unsigned *sz );
|
2006-08-09 19:14:05 +00:00
|
|
|
|
2023-10-09 12:48:02 +03:00
|
|
|
bool brw_should_dump_shader_bin(void);
|
|
|
|
|
void brw_dump_shader_bin(void *assembly, int start_offset, int end_offset,
|
|
|
|
|
const char *identifier);
|
|
|
|
|
|
2019-05-23 19:05:23 +03:00
|
|
|
bool brw_try_override_assembly(struct brw_codegen *p, int start_offset,
|
|
|
|
|
const char *identifier);
|
|
|
|
|
|
2023-11-02 04:44:59 +08:00
|
|
|
void brw_realign(struct brw_codegen *p, unsigned alignment);
|
2020-08-07 21:59:12 -05:00
|
|
|
int brw_append_data(struct brw_codegen *p, void *data,
|
2023-11-02 04:44:59 +08:00
|
|
|
unsigned size, unsigned alignment);
|
2024-12-14 14:44:47 -08:00
|
|
|
brw_eu_inst *brw_next_insn(struct brw_codegen *p, unsigned opcode);
|
2020-09-04 12:09:11 -05:00
|
|
|
void brw_add_reloc(struct brw_codegen *p, uint32_t id,
|
|
|
|
|
enum brw_shader_reloc_type type,
|
|
|
|
|
uint32_t offset, uint32_t delta);
|
2024-12-14 14:44:47 -08:00
|
|
|
void brw_set_dest(struct brw_codegen *p, brw_eu_inst *insn, struct brw_reg dest);
|
|
|
|
|
void brw_set_src0(struct brw_codegen *p, brw_eu_inst *insn, struct brw_reg reg);
|
2011-08-07 13:16:06 -07:00
|
|
|
|
2006-08-09 19:14:05 +00:00
|
|
|
/* Helpers for regular instructions:
|
|
|
|
|
*/
|
2014-06-13 14:29:25 -07:00
|
|
|
#define ALU1(OP) \
|
2024-12-14 14:44:47 -08:00
|
|
|
brw_eu_inst *brw_##OP(struct brw_codegen *p, \
|
2014-06-13 14:29:25 -07:00
|
|
|
struct brw_reg dest, \
|
2006-08-09 19:14:05 +00:00
|
|
|
struct brw_reg src0);
|
|
|
|
|
|
2014-06-13 14:29:25 -07:00
|
|
|
#define ALU2(OP) \
|
2024-12-14 14:44:47 -08:00
|
|
|
brw_eu_inst *brw_##OP(struct brw_codegen *p, \
|
2014-06-13 14:29:25 -07:00
|
|
|
struct brw_reg dest, \
|
|
|
|
|
struct brw_reg src0, \
|
2006-08-09 19:14:05 +00:00
|
|
|
struct brw_reg src1);
|
|
|
|
|
|
2014-06-13 14:29:25 -07:00
|
|
|
#define ALU3(OP) \
|
2024-12-14 14:44:47 -08:00
|
|
|
brw_eu_inst *brw_##OP(struct brw_codegen *p, \
|
2014-06-13 14:29:25 -07:00
|
|
|
struct brw_reg dest, \
|
|
|
|
|
struct brw_reg src0, \
|
|
|
|
|
struct brw_reg src1, \
|
2010-03-22 10:05:42 -07:00
|
|
|
struct brw_reg src2);
|
|
|
|
|
|
2006-08-09 19:14:05 +00:00
|
|
|
ALU1(MOV)
|
|
|
|
|
ALU2(SEL)
|
|
|
|
|
ALU1(NOT)
|
|
|
|
|
ALU2(AND)
|
|
|
|
|
ALU2(OR)
|
|
|
|
|
ALU2(XOR)
|
|
|
|
|
ALU2(SHR)
|
|
|
|
|
ALU2(SHL)
|
2016-07-07 08:38:22 +02:00
|
|
|
ALU1(DIM)
|
2006-08-09 19:14:05 +00:00
|
|
|
ALU2(ASR)
|
2019-05-29 11:43:30 -07:00
|
|
|
ALU2(ROL)
|
|
|
|
|
ALU2(ROR)
|
2015-11-22 20:12:17 -08:00
|
|
|
ALU3(CSEL)
|
2013-01-09 11:35:47 -08:00
|
|
|
ALU1(F32TO16)
|
|
|
|
|
ALU1(F16TO32)
|
2006-08-09 19:14:05 +00:00
|
|
|
ALU2(ADD)
|
2020-06-05 22:40:26 -07:00
|
|
|
ALU3(ADD3)
|
2012-07-07 08:28:46 -07:00
|
|
|
ALU2(AVG)
|
2006-08-09 19:14:05 +00:00
|
|
|
ALU2(MUL)
|
|
|
|
|
ALU1(FRC)
|
|
|
|
|
ALU1(RNDD)
|
2020-01-16 11:17:14 -08:00
|
|
|
ALU1(RNDE)
|
2019-08-22 11:15:50 -05:00
|
|
|
ALU1(RNDU)
|
2020-01-16 11:17:14 -08:00
|
|
|
ALU1(RNDZ)
|
2006-08-09 19:14:05 +00:00
|
|
|
ALU2(MAC)
|
|
|
|
|
ALU2(MACH)
|
|
|
|
|
ALU1(LZD)
|
|
|
|
|
ALU2(DP4)
|
|
|
|
|
ALU2(DPH)
|
|
|
|
|
ALU2(DP3)
|
|
|
|
|
ALU2(DP2)
|
2021-02-23 18:46:53 -08:00
|
|
|
ALU3(DP4A)
|
2006-08-09 19:14:05 +00:00
|
|
|
ALU2(LINE)
|
2010-03-10 14:46:27 -08:00
|
|
|
ALU2(PLN)
|
2010-03-22 10:05:42 -07:00
|
|
|
ALU3(MAD)
|
2012-12-01 21:49:43 -08:00
|
|
|
ALU3(LRP)
|
2013-04-09 17:56:19 -07:00
|
|
|
ALU1(BFREV)
|
|
|
|
|
ALU3(BFE)
|
|
|
|
|
ALU2(BFI1)
|
|
|
|
|
ALU3(BFI2)
|
|
|
|
|
ALU1(FBH)
|
|
|
|
|
ALU1(FBL)
|
|
|
|
|
ALU1(CBIT)
|
2013-09-19 13:01:08 -07:00
|
|
|
ALU2(ADDC)
|
|
|
|
|
ALU2(SUBB)
|
2006-08-09 19:14:05 +00:00
|
|
|
|
|
|
|
|
#undef ALU1
|
|
|
|
|
#undef ALU2
|
2010-03-22 10:05:42 -07:00
|
|
|
#undef ALU3
|
2006-08-09 19:14:05 +00:00
|
|
|
|
2022-06-28 17:49:38 -07:00
|
|
|
static inline unsigned
|
|
|
|
|
reg_unit(const struct intel_device_info *devinfo)
|
|
|
|
|
{
|
|
|
|
|
return devinfo->ver >= 20 ? 2 : 1;
|
|
|
|
|
}
|
|
|
|
|
|
2006-08-09 19:14:05 +00:00
|
|
|
|
|
|
|
|
/* Helpers for SEND instruction:
|
|
|
|
|
*/
|
2011-08-07 13:16:06 -07:00
|
|
|
|
2018-06-11 10:49:39 -07:00
|
|
|
/**
|
|
|
|
|
* Construct a message descriptor immediate with the specified common
|
|
|
|
|
* descriptor controls.
|
|
|
|
|
*/
|
|
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_message_desc(const struct intel_device_info *devinfo,
|
2018-06-11 10:49:39 -07:00
|
|
|
unsigned msg_length,
|
|
|
|
|
unsigned response_length,
|
|
|
|
|
bool header_present)
|
|
|
|
|
{
|
2024-02-16 14:52:03 -08:00
|
|
|
assert(msg_length % reg_unit(devinfo) == 0);
|
|
|
|
|
assert(response_length % reg_unit(devinfo) == 0);
|
|
|
|
|
return (SET_BITS(msg_length / reg_unit(devinfo), 28, 25) |
|
|
|
|
|
SET_BITS(response_length / reg_unit(devinfo), 24, 20) |
|
|
|
|
|
SET_BITS(header_present, 19, 19));
|
2018-06-11 10:49:39 -07:00
|
|
|
}
|
|
|
|
|
|
2018-11-16 18:45:46 -06:00
|
|
|
static inline unsigned
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_message_desc_mlen(const struct intel_device_info *devinfo, uint32_t desc)
|
2018-11-16 18:45:46 -06:00
|
|
|
{
|
2024-02-16 14:52:03 -08:00
|
|
|
return GET_BITS(desc, 28, 25) * reg_unit(devinfo);
|
2018-11-16 18:45:46 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_message_desc_rlen(const struct intel_device_info *devinfo, uint32_t desc)
|
2018-11-16 18:45:46 -06:00
|
|
|
{
|
2024-02-16 14:52:03 -08:00
|
|
|
return GET_BITS(desc, 24, 20) * reg_unit(devinfo);
|
2018-11-16 18:45:46 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
2021-04-12 20:17:16 -07:00
|
|
|
brw_message_desc_header_present(ASSERTED
|
|
|
|
|
const struct intel_device_info *devinfo,
|
2018-11-16 18:45:46 -06:00
|
|
|
uint32_t desc)
|
|
|
|
|
{
|
|
|
|
|
return GET_BITS(desc, 19, 19);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned
|
2022-07-07 01:00:19 -07:00
|
|
|
brw_message_ex_desc(const struct intel_device_info *devinfo,
|
2018-11-16 18:45:46 -06:00
|
|
|
unsigned ex_msg_length)
|
|
|
|
|
{
|
2022-07-07 01:00:19 -07:00
|
|
|
assert(ex_msg_length % reg_unit(devinfo) == 0);
|
2022-08-02 17:31:50 +02:00
|
|
|
return devinfo->ver >= 20 ?
|
|
|
|
|
SET_BITS(ex_msg_length / reg_unit(devinfo), 10, 6) :
|
|
|
|
|
SET_BITS(ex_msg_length / reg_unit(devinfo), 9, 6);
|
2018-11-16 18:45:46 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned
|
2022-07-07 01:00:19 -07:00
|
|
|
brw_message_ex_desc_ex_mlen(const struct intel_device_info *devinfo,
|
2018-11-16 18:45:46 -06:00
|
|
|
uint32_t ex_desc)
|
|
|
|
|
{
|
2022-08-02 17:31:50 +02:00
|
|
|
return devinfo->ver >= 20 ?
|
|
|
|
|
GET_BITS(ex_desc, 10, 6) * reg_unit(devinfo) :
|
|
|
|
|
GET_BITS(ex_desc, 9, 6) * reg_unit(devinfo);
|
2018-11-16 18:45:46 -06:00
|
|
|
}
|
|
|
|
|
|
2019-08-08 19:16:32 -07:00
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_urb_desc(const struct intel_device_info *devinfo,
|
2019-08-08 19:16:32 -07:00
|
|
|
unsigned msg_type,
|
|
|
|
|
bool per_slot_offset_present,
|
|
|
|
|
bool channel_mask_present,
|
|
|
|
|
unsigned global_offset)
|
|
|
|
|
{
|
2024-02-16 14:52:03 -08:00
|
|
|
return (SET_BITS(per_slot_offset_present, 17, 17) |
|
|
|
|
|
SET_BITS(channel_mask_present, 15, 15) |
|
|
|
|
|
SET_BITS(global_offset, 14, 4) |
|
|
|
|
|
SET_BITS(msg_type, 3, 0));
|
2019-08-08 19:16:32 -07:00
|
|
|
}
|
|
|
|
|
|
2019-09-12 13:23:46 -05:00
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_urb_desc_msg_type(ASSERTED const struct intel_device_info *devinfo,
|
2019-09-12 13:23:46 -05:00
|
|
|
uint32_t desc)
|
|
|
|
|
{
|
|
|
|
|
return GET_BITS(desc, 3, 0);
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-15 16:21:14 -05:00
|
|
|
static inline uint32_t
|
|
|
|
|
brw_urb_fence_desc(const struct intel_device_info *devinfo)
|
|
|
|
|
{
|
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
|
return brw_urb_desc(devinfo, GFX125_URB_OPCODE_FENCE, false, false, 0);
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-02 15:15:15 -07:00
|
|
|
/**
|
|
|
|
|
* Construct a message descriptor immediate with the specified sampler
|
|
|
|
|
* function controls.
|
|
|
|
|
*/
|
|
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_sampler_desc(const struct intel_device_info *devinfo,
|
2018-06-02 15:15:15 -07:00
|
|
|
unsigned binding_table_index,
|
|
|
|
|
unsigned sampler,
|
|
|
|
|
unsigned msg_type,
|
|
|
|
|
unsigned simd_mode,
|
|
|
|
|
unsigned return_format)
|
|
|
|
|
{
|
|
|
|
|
const unsigned desc = (SET_BITS(binding_table_index, 7, 0) |
|
|
|
|
|
SET_BITS(sampler, 11, 8));
|
2020-07-07 17:40:49 -07:00
|
|
|
|
2023-03-04 18:23:06 -08:00
|
|
|
/* From GFX20 Bspec: Shared Functions - Message Descriptor -
|
|
|
|
|
* Sampling Engine:
|
|
|
|
|
*
|
|
|
|
|
* Message Type[5] 31 This bit represents the upper bit of message type
|
|
|
|
|
* 6-bit encoding (c.f. [16:12]). This bit is set
|
|
|
|
|
* for messages with programmable offsets.
|
|
|
|
|
*/
|
|
|
|
|
if (devinfo->ver >= 20)
|
|
|
|
|
return desc | SET_BITS(msg_type & 0x1F, 16, 12) |
|
|
|
|
|
SET_BITS(simd_mode & 0x3, 18, 17) |
|
|
|
|
|
SET_BITS(simd_mode >> 2, 29, 29) |
|
|
|
|
|
SET_BITS(return_format, 30, 30) |
|
|
|
|
|
SET_BITS(msg_type >> 5, 31, 31);
|
|
|
|
|
|
2020-07-07 17:40:49 -07:00
|
|
|
/* From the CHV Bspec: Shared Functions - Message Descriptor -
|
|
|
|
|
* Sampling Engine:
|
|
|
|
|
*
|
|
|
|
|
* SIMD Mode[2] 29 This field is the upper bit of the 3-bit
|
|
|
|
|
* SIMD Mode field.
|
|
|
|
|
*/
|
2024-02-16 14:52:03 -08:00
|
|
|
return desc | SET_BITS(msg_type, 16, 12) |
|
|
|
|
|
SET_BITS(simd_mode & 0x3, 18, 17) |
|
|
|
|
|
SET_BITS(simd_mode >> 2, 29, 29) |
|
|
|
|
|
SET_BITS(return_format, 30, 30);
|
2018-06-02 15:15:15 -07:00
|
|
|
}
|
2018-06-11 10:49:39 -07:00
|
|
|
|
2018-11-16 18:45:46 -06:00
|
|
|
static inline unsigned
|
2021-04-12 20:17:16 -07:00
|
|
|
brw_sampler_desc_binding_table_index(UNUSED
|
|
|
|
|
const struct intel_device_info *devinfo,
|
2018-11-16 18:45:46 -06:00
|
|
|
uint32_t desc)
|
|
|
|
|
{
|
|
|
|
|
return GET_BITS(desc, 7, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned
|
2021-04-12 20:17:16 -07:00
|
|
|
brw_sampler_desc_sampler(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
|
uint32_t desc)
|
2018-11-16 18:45:46 -06:00
|
|
|
{
|
|
|
|
|
return GET_BITS(desc, 11, 8);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_sampler_desc_msg_type(const struct intel_device_info *devinfo, uint32_t desc)
|
2018-11-16 18:45:46 -06:00
|
|
|
{
|
2023-03-04 18:23:06 -08:00
|
|
|
if (devinfo->ver >= 20)
|
|
|
|
|
return GET_BITS(desc, 31, 31) << 5 | GET_BITS(desc, 16, 12);
|
2018-11-16 18:45:46 -06:00
|
|
|
else
|
2024-02-16 14:52:03 -08:00
|
|
|
return GET_BITS(desc, 16, 12);
|
2018-11-16 18:45:46 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned
|
2021-04-12 20:17:16 -07:00
|
|
|
brw_sampler_desc_simd_mode(const struct intel_device_info *devinfo,
|
|
|
|
|
uint32_t desc)
|
2018-11-16 18:45:46 -06:00
|
|
|
{
|
2024-02-16 14:52:03 -08:00
|
|
|
return GET_BITS(desc, 18, 17) | GET_BITS(desc, 29, 29) << 2;
|
2018-11-16 18:45:46 -06:00
|
|
|
}
|
|
|
|
|
|
2024-02-16 14:52:03 -08:00
|
|
|
static inline unsigned
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_sampler_desc_return_format(ASSERTED const struct intel_device_info *devinfo,
|
2018-11-16 18:45:46 -06:00
|
|
|
uint32_t desc)
|
|
|
|
|
{
|
2024-02-16 14:52:03 -08:00
|
|
|
return GET_BITS(desc, 30, 30);
|
2018-11-16 18:45:46 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Construct a message descriptor for the dataport
|
|
|
|
|
*/
|
|
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_dp_desc(const struct intel_device_info *devinfo,
|
2018-11-16 18:45:46 -06:00
|
|
|
unsigned binding_table_index,
|
|
|
|
|
unsigned msg_type,
|
|
|
|
|
unsigned msg_control)
|
|
|
|
|
{
|
2024-02-16 14:52:03 -08:00
|
|
|
return SET_BITS(binding_table_index, 7, 0) |
|
|
|
|
|
SET_BITS(msg_control, 13, 8) |
|
|
|
|
|
SET_BITS(msg_type, 18, 14);
|
2018-11-16 18:45:46 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_dp_desc_binding_table_index(UNUSED const struct intel_device_info *devinfo,
|
2018-11-16 18:45:46 -06:00
|
|
|
uint32_t desc)
|
|
|
|
|
{
|
|
|
|
|
return GET_BITS(desc, 7, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_dp_desc_msg_type(const struct intel_device_info *devinfo, uint32_t desc)
|
2018-11-16 18:45:46 -06:00
|
|
|
{
|
2024-02-16 14:52:03 -08:00
|
|
|
return GET_BITS(desc, 18, 14);
|
2018-11-16 18:45:46 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_dp_desc_msg_control(const struct intel_device_info *devinfo, uint32_t desc)
|
2018-11-16 18:45:46 -06:00
|
|
|
{
|
2024-02-16 14:52:03 -08:00
|
|
|
return GET_BITS(desc, 13, 8);
|
2018-11-16 18:45:46 -06:00
|
|
|
}
|
|
|
|
|
|
2018-06-07 10:50:20 -07:00
|
|
|
/**
|
|
|
|
|
* Construct a message descriptor immediate with the specified dataport read
|
|
|
|
|
* function controls.
|
|
|
|
|
*/
|
|
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_dp_read_desc(const struct intel_device_info *devinfo,
|
2018-06-07 10:50:20 -07:00
|
|
|
unsigned binding_table_index,
|
|
|
|
|
unsigned msg_control,
|
|
|
|
|
unsigned msg_type,
|
|
|
|
|
unsigned target_cache)
|
|
|
|
|
{
|
2024-02-16 14:52:03 -08:00
|
|
|
return brw_dp_desc(devinfo, binding_table_index, msg_type, msg_control);
|
2018-06-07 10:50:20 -07:00
|
|
|
}
|
|
|
|
|
|
2018-11-16 18:45:46 -06:00
|
|
|
static inline unsigned
|
2021-04-12 20:17:16 -07:00
|
|
|
brw_dp_read_desc_msg_type(const struct intel_device_info *devinfo,
|
|
|
|
|
uint32_t desc)
|
2018-11-16 18:45:46 -06:00
|
|
|
{
|
2024-02-16 14:52:03 -08:00
|
|
|
return brw_dp_desc_msg_type(devinfo, desc);
|
2018-11-16 18:45:46 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_dp_read_desc_msg_control(const struct intel_device_info *devinfo,
|
2018-11-16 18:45:46 -06:00
|
|
|
uint32_t desc)
|
|
|
|
|
{
|
2024-02-16 14:52:03 -08:00
|
|
|
return brw_dp_desc_msg_control(devinfo, desc);
|
2018-11-16 18:45:46 -06:00
|
|
|
}
|
|
|
|
|
|
2018-07-09 16:12:59 -07:00
|
|
|
/**
|
|
|
|
|
* Construct a message descriptor immediate with the specified dataport write
|
|
|
|
|
* function controls.
|
|
|
|
|
*/
|
|
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_dp_write_desc(const struct intel_device_info *devinfo,
|
2018-07-09 16:12:59 -07:00
|
|
|
unsigned binding_table_index,
|
|
|
|
|
unsigned msg_control,
|
|
|
|
|
unsigned msg_type,
|
|
|
|
|
unsigned send_commit_msg)
|
|
|
|
|
{
|
2024-02-16 14:52:03 -08:00
|
|
|
assert(!send_commit_msg);
|
|
|
|
|
return brw_dp_desc(devinfo, binding_table_index, msg_type, msg_control) |
|
|
|
|
|
SET_BITS(send_commit_msg, 17, 17);
|
2018-07-09 16:12:59 -07:00
|
|
|
}
|
|
|
|
|
|
2018-11-16 18:45:46 -06:00
|
|
|
static inline unsigned
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_dp_write_desc_msg_type(const struct intel_device_info *devinfo,
|
2018-11-16 18:45:46 -06:00
|
|
|
uint32_t desc)
|
|
|
|
|
{
|
2024-02-16 14:52:03 -08:00
|
|
|
return brw_dp_desc_msg_type(devinfo, desc);
|
2018-11-16 18:45:46 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_dp_write_desc_msg_control(const struct intel_device_info *devinfo,
|
2018-11-16 18:45:46 -06:00
|
|
|
uint32_t desc)
|
|
|
|
|
{
|
2024-02-16 14:52:03 -08:00
|
|
|
return brw_dp_desc_msg_control(devinfo, desc);
|
2018-11-16 18:45:46 -06:00
|
|
|
}
|
|
|
|
|
|
2018-06-07 15:22:58 -07:00
|
|
|
/**
|
|
|
|
|
* Construct a message descriptor immediate with the specified dataport
|
|
|
|
|
* surface function controls.
|
|
|
|
|
*/
|
|
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_dp_surface_desc(const struct intel_device_info *devinfo,
|
2018-06-07 15:22:58 -07:00
|
|
|
unsigned msg_type,
|
|
|
|
|
unsigned msg_control)
|
|
|
|
|
{
|
2018-11-16 18:45:46 -06:00
|
|
|
/* We'll OR in the binding table index later */
|
|
|
|
|
return brw_dp_desc(devinfo, 0, msg_type, msg_control);
|
2018-06-07 15:22:58 -07:00
|
|
|
}
|
|
|
|
|
|
2018-10-29 16:09:30 -05:00
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_dp_untyped_atomic_desc(const struct intel_device_info *devinfo,
|
2018-10-29 16:09:30 -05:00
|
|
|
unsigned exec_size, /**< 0 for SIMD4x2 */
|
|
|
|
|
unsigned atomic_op,
|
|
|
|
|
bool response_expected)
|
|
|
|
|
{
|
|
|
|
|
assert(exec_size <= 8 || exec_size == 16);
|
|
|
|
|
|
|
|
|
|
unsigned msg_type;
|
2024-02-16 14:52:03 -08:00
|
|
|
if (exec_size > 0) {
|
|
|
|
|
msg_type = HSW_DATAPORT_DC_PORT1_UNTYPED_ATOMIC_OP;
|
2018-10-29 16:09:30 -05:00
|
|
|
} else {
|
2024-02-16 14:52:03 -08:00
|
|
|
msg_type = HSW_DATAPORT_DC_PORT1_UNTYPED_ATOMIC_OP_SIMD4X2;
|
2018-10-29 16:09:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const unsigned msg_control =
|
|
|
|
|
SET_BITS(atomic_op, 3, 0) |
|
|
|
|
|
SET_BITS(0 < exec_size && exec_size <= 8, 4, 4) |
|
|
|
|
|
SET_BITS(response_expected, 5, 5);
|
|
|
|
|
|
|
|
|
|
return brw_dp_surface_desc(devinfo, msg_type, msg_control);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_dp_untyped_atomic_float_desc(const struct intel_device_info *devinfo,
|
2018-10-29 16:09:30 -05:00
|
|
|
unsigned exec_size,
|
|
|
|
|
unsigned atomic_op,
|
|
|
|
|
bool response_expected)
|
|
|
|
|
{
|
|
|
|
|
assert(exec_size <= 8 || exec_size == 16);
|
|
|
|
|
|
|
|
|
|
assert(exec_size > 0);
|
2021-03-29 15:16:59 -07:00
|
|
|
const unsigned msg_type = GFX9_DATAPORT_DC_PORT1_UNTYPED_ATOMIC_FLOAT_OP;
|
2018-10-29 16:09:30 -05:00
|
|
|
|
|
|
|
|
const unsigned msg_control =
|
|
|
|
|
SET_BITS(atomic_op, 1, 0) |
|
|
|
|
|
SET_BITS(exec_size <= 8, 4, 4) |
|
|
|
|
|
SET_BITS(response_expected, 5, 5);
|
|
|
|
|
|
|
|
|
|
return brw_dp_surface_desc(devinfo, msg_type, msg_control);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned
|
|
|
|
|
brw_mdc_cmask(unsigned num_channels)
|
|
|
|
|
{
|
|
|
|
|
/* See also MDC_CMASK in the SKL PRM Vol 2d. */
|
|
|
|
|
return 0xf & (0xf << num_channels);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_dp_untyped_surface_rw_desc(const struct intel_device_info *devinfo,
|
2018-10-29 16:09:30 -05:00
|
|
|
unsigned exec_size, /**< 0 for SIMD4x2 */
|
|
|
|
|
unsigned num_channels,
|
|
|
|
|
bool write)
|
|
|
|
|
{
|
|
|
|
|
assert(exec_size <= 8 || exec_size == 16);
|
|
|
|
|
|
2024-02-16 14:52:03 -08:00
|
|
|
const unsigned msg_type =
|
|
|
|
|
write ? HSW_DATAPORT_DC_PORT1_UNTYPED_SURFACE_WRITE :
|
|
|
|
|
HSW_DATAPORT_DC_PORT1_UNTYPED_SURFACE_READ;
|
2018-10-29 16:09:30 -05:00
|
|
|
|
|
|
|
|
/* See also MDC_SM3 in the SKL PRM Vol 2d. */
|
|
|
|
|
const unsigned simd_mode = exec_size == 0 ? 0 : /* SIMD4x2 */
|
|
|
|
|
exec_size <= 8 ? 2 : 1;
|
|
|
|
|
|
|
|
|
|
const unsigned msg_control =
|
|
|
|
|
SET_BITS(brw_mdc_cmask(num_channels), 3, 0) |
|
|
|
|
|
SET_BITS(simd_mode, 5, 4);
|
|
|
|
|
|
|
|
|
|
return brw_dp_surface_desc(devinfo, msg_type, msg_control);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned
|
|
|
|
|
brw_mdc_ds(unsigned bit_size)
|
|
|
|
|
{
|
|
|
|
|
switch (bit_size) {
|
|
|
|
|
case 8:
|
2021-03-29 15:16:59 -07:00
|
|
|
return GFX7_BYTE_SCATTERED_DATA_ELEMENT_BYTE;
|
2018-10-29 16:09:30 -05:00
|
|
|
case 16:
|
2021-03-29 15:16:59 -07:00
|
|
|
return GFX7_BYTE_SCATTERED_DATA_ELEMENT_WORD;
|
2018-10-29 16:09:30 -05:00
|
|
|
case 32:
|
2021-03-29 15:16:59 -07:00
|
|
|
return GFX7_BYTE_SCATTERED_DATA_ELEMENT_DWORD;
|
2018-10-29 16:09:30 -05:00
|
|
|
default:
|
|
|
|
|
unreachable("Unsupported bit_size for byte scattered messages");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_dp_byte_scattered_rw_desc(const struct intel_device_info *devinfo,
|
2018-10-29 16:09:30 -05:00
|
|
|
unsigned exec_size,
|
|
|
|
|
unsigned bit_size,
|
|
|
|
|
bool write)
|
|
|
|
|
{
|
|
|
|
|
assert(exec_size <= 8 || exec_size == 16);
|
|
|
|
|
|
|
|
|
|
const unsigned msg_type =
|
|
|
|
|
write ? HSW_DATAPORT_DC_PORT0_BYTE_SCATTERED_WRITE :
|
|
|
|
|
HSW_DATAPORT_DC_PORT0_BYTE_SCATTERED_READ;
|
|
|
|
|
|
|
|
|
|
assert(exec_size > 0);
|
|
|
|
|
const unsigned msg_control =
|
|
|
|
|
SET_BITS(exec_size == 16, 0, 0) |
|
|
|
|
|
SET_BITS(brw_mdc_ds(bit_size), 3, 2);
|
|
|
|
|
|
|
|
|
|
return brw_dp_surface_desc(devinfo, msg_type, msg_control);
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-08 02:41:33 -07:00
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_dp_dword_scattered_rw_desc(const struct intel_device_info *devinfo,
|
2015-04-08 02:41:33 -07:00
|
|
|
unsigned exec_size,
|
|
|
|
|
bool write)
|
|
|
|
|
{
|
|
|
|
|
assert(exec_size == 8 || exec_size == 16);
|
|
|
|
|
|
2024-02-16 14:52:03 -08:00
|
|
|
const unsigned msg_type =
|
|
|
|
|
write ? GFX6_DATAPORT_WRITE_MESSAGE_DWORD_SCATTERED_WRITE :
|
|
|
|
|
GFX7_DATAPORT_DC_DWORD_SCATTERED_READ;
|
2015-04-08 02:41:33 -07:00
|
|
|
|
|
|
|
|
const unsigned msg_control =
|
|
|
|
|
SET_BITS(1, 1, 1) | /* Legacy SIMD Mode */
|
|
|
|
|
SET_BITS(exec_size == 16, 0, 0);
|
|
|
|
|
|
|
|
|
|
return brw_dp_surface_desc(devinfo, msg_type, msg_control);
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-29 14:20:39 -07:00
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_dp_oword_block_rw_desc(const struct intel_device_info *devinfo,
|
2020-10-29 14:20:39 -07:00
|
|
|
bool align_16B,
|
|
|
|
|
unsigned num_dwords,
|
|
|
|
|
bool write)
|
|
|
|
|
{
|
|
|
|
|
/* Writes can only have addresses aligned by OWORDs (16 Bytes). */
|
|
|
|
|
assert(!write || align_16B);
|
|
|
|
|
|
|
|
|
|
const unsigned msg_type =
|
2021-03-29 15:16:59 -07:00
|
|
|
write ? GFX7_DATAPORT_DC_OWORD_BLOCK_WRITE :
|
|
|
|
|
align_16B ? GFX7_DATAPORT_DC_OWORD_BLOCK_READ :
|
|
|
|
|
GFX7_DATAPORT_DC_UNALIGNED_OWORD_BLOCK_READ;
|
2020-10-29 14:20:39 -07:00
|
|
|
|
|
|
|
|
const unsigned msg_control =
|
|
|
|
|
SET_BITS(BRW_DATAPORT_OWORD_BLOCK_DWORDS(num_dwords), 2, 0);
|
|
|
|
|
|
|
|
|
|
return brw_dp_surface_desc(devinfo, msg_type, msg_control);
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-14 17:13:57 -06:00
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_dp_a64_untyped_surface_rw_desc(const struct intel_device_info *devinfo,
|
2018-11-14 17:13:57 -06:00
|
|
|
unsigned exec_size, /**< 0 for SIMD4x2 */
|
|
|
|
|
unsigned num_channels,
|
|
|
|
|
bool write)
|
|
|
|
|
{
|
|
|
|
|
assert(exec_size <= 8 || exec_size == 16);
|
|
|
|
|
|
|
|
|
|
unsigned msg_type =
|
2021-03-29 15:16:59 -07:00
|
|
|
write ? GFX8_DATAPORT_DC_PORT1_A64_UNTYPED_SURFACE_WRITE :
|
|
|
|
|
GFX8_DATAPORT_DC_PORT1_A64_UNTYPED_SURFACE_READ;
|
2018-11-14 17:13:57 -06:00
|
|
|
|
|
|
|
|
/* See also MDC_SM3 in the SKL PRM Vol 2d. */
|
|
|
|
|
const unsigned simd_mode = exec_size == 0 ? 0 : /* SIMD4x2 */
|
|
|
|
|
exec_size <= 8 ? 2 : 1;
|
|
|
|
|
|
|
|
|
|
const unsigned msg_control =
|
|
|
|
|
SET_BITS(brw_mdc_cmask(num_channels), 3, 0) |
|
|
|
|
|
SET_BITS(simd_mode, 5, 4);
|
|
|
|
|
|
2021-03-29 15:16:59 -07:00
|
|
|
return brw_dp_desc(devinfo, GFX8_BTI_STATELESS_NON_COHERENT,
|
2020-04-29 17:14:58 -05:00
|
|
|
msg_type, msg_control);
|
2018-11-14 17:13:57 -06:00
|
|
|
}
|
|
|
|
|
|
2020-10-05 14:43:41 -07:00
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_dp_a64_oword_block_rw_desc(const struct intel_device_info *devinfo,
|
2020-10-05 14:43:41 -07:00
|
|
|
bool align_16B,
|
|
|
|
|
unsigned num_dwords,
|
|
|
|
|
bool write)
|
|
|
|
|
{
|
|
|
|
|
/* Writes can only have addresses aligned by OWORDs (16 Bytes). */
|
|
|
|
|
assert(!write || align_16B);
|
|
|
|
|
|
|
|
|
|
unsigned msg_type =
|
2021-03-29 15:16:59 -07:00
|
|
|
write ? GFX9_DATAPORT_DC_PORT1_A64_OWORD_BLOCK_WRITE :
|
|
|
|
|
GFX9_DATAPORT_DC_PORT1_A64_OWORD_BLOCK_READ;
|
2020-10-05 14:43:41 -07:00
|
|
|
|
|
|
|
|
unsigned msg_control =
|
|
|
|
|
SET_BITS(!align_16B, 4, 3) |
|
|
|
|
|
SET_BITS(BRW_DATAPORT_OWORD_BLOCK_DWORDS(num_dwords), 2, 0);
|
|
|
|
|
|
2021-03-29 15:16:59 -07:00
|
|
|
return brw_dp_desc(devinfo, GFX8_BTI_STATELESS_NON_COHERENT,
|
2020-10-05 14:43:41 -07:00
|
|
|
msg_type, msg_control);
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-14 17:13:57 -06:00
|
|
|
/**
|
|
|
|
|
* Calculate the data size (see MDC_A64_DS in the "Structures" volume of the
|
|
|
|
|
* Skylake PRM).
|
|
|
|
|
*/
|
|
|
|
|
static inline uint32_t
|
|
|
|
|
brw_mdc_a64_ds(unsigned elems)
|
|
|
|
|
{
|
|
|
|
|
switch (elems) {
|
|
|
|
|
case 1: return 0;
|
|
|
|
|
case 2: return 1;
|
|
|
|
|
case 4: return 2;
|
|
|
|
|
case 8: return 3;
|
|
|
|
|
default:
|
|
|
|
|
unreachable("Unsupported elmeent count for A64 scattered message");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_dp_a64_byte_scattered_rw_desc(const struct intel_device_info *devinfo,
|
2018-11-14 17:13:57 -06:00
|
|
|
unsigned exec_size, /**< 0 for SIMD4x2 */
|
|
|
|
|
unsigned bit_size,
|
|
|
|
|
bool write)
|
|
|
|
|
{
|
|
|
|
|
assert(exec_size <= 8 || exec_size == 16);
|
|
|
|
|
|
|
|
|
|
unsigned msg_type =
|
2021-03-29 15:16:59 -07:00
|
|
|
write ? GFX8_DATAPORT_DC_PORT1_A64_SCATTERED_WRITE :
|
|
|
|
|
GFX9_DATAPORT_DC_PORT1_A64_SCATTERED_READ;
|
2018-11-14 17:13:57 -06:00
|
|
|
|
|
|
|
|
const unsigned msg_control =
|
2021-03-29 15:16:59 -07:00
|
|
|
SET_BITS(GFX8_A64_SCATTERED_SUBTYPE_BYTE, 1, 0) |
|
2018-11-14 17:13:57 -06:00
|
|
|
SET_BITS(brw_mdc_a64_ds(bit_size / 8), 3, 2) |
|
|
|
|
|
SET_BITS(exec_size == 16, 4, 4);
|
|
|
|
|
|
2021-03-29 15:16:59 -07:00
|
|
|
return brw_dp_desc(devinfo, GFX8_BTI_STATELESS_NON_COHERENT,
|
2020-04-29 17:14:58 -05:00
|
|
|
msg_type, msg_control);
|
2018-11-14 17:13:57 -06:00
|
|
|
}
|
|
|
|
|
|
2018-11-26 15:15:04 -06:00
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_dp_a64_untyped_atomic_desc(const struct intel_device_info *devinfo,
|
2019-06-19 12:47:19 +01:00
|
|
|
ASSERTED unsigned exec_size, /**< 0 for SIMD4x2 */
|
2018-11-26 15:15:04 -06:00
|
|
|
unsigned bit_size,
|
|
|
|
|
unsigned atomic_op,
|
|
|
|
|
bool response_expected)
|
|
|
|
|
{
|
|
|
|
|
assert(exec_size == 8);
|
2021-01-11 22:18:11 -06:00
|
|
|
assert(bit_size == 16 || bit_size == 32 || bit_size == 64);
|
2021-03-29 14:41:58 -07:00
|
|
|
assert(devinfo->ver >= 12 || bit_size >= 32);
|
2018-11-26 15:15:04 -06:00
|
|
|
|
2021-01-11 22:18:11 -06:00
|
|
|
const unsigned msg_type = bit_size == 16 ?
|
2021-03-29 15:16:59 -07:00
|
|
|
GFX12_DATAPORT_DC_PORT1_A64_UNTYPED_ATOMIC_HALF_INT_OP :
|
|
|
|
|
GFX8_DATAPORT_DC_PORT1_A64_UNTYPED_ATOMIC_OP;
|
2018-11-26 15:15:04 -06:00
|
|
|
|
|
|
|
|
const unsigned msg_control =
|
|
|
|
|
SET_BITS(atomic_op, 3, 0) |
|
|
|
|
|
SET_BITS(bit_size == 64, 4, 4) |
|
|
|
|
|
SET_BITS(response_expected, 5, 5);
|
|
|
|
|
|
2021-03-29 15:16:59 -07:00
|
|
|
return brw_dp_desc(devinfo, GFX8_BTI_STATELESS_NON_COHERENT,
|
2020-04-29 17:14:58 -05:00
|
|
|
msg_type, msg_control);
|
2018-11-26 15:15:04 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_dp_a64_untyped_atomic_float_desc(const struct intel_device_info *devinfo,
|
2019-06-19 12:47:19 +01:00
|
|
|
ASSERTED unsigned exec_size,
|
2021-01-11 22:18:11 -06:00
|
|
|
unsigned bit_size,
|
2018-11-26 15:15:04 -06:00
|
|
|
unsigned atomic_op,
|
|
|
|
|
bool response_expected)
|
|
|
|
|
{
|
|
|
|
|
assert(exec_size == 8);
|
2021-01-11 22:18:11 -06:00
|
|
|
assert(bit_size == 16 || bit_size == 32);
|
2021-03-29 14:41:58 -07:00
|
|
|
assert(devinfo->ver >= 12 || bit_size == 32);
|
2018-11-26 15:15:04 -06:00
|
|
|
|
|
|
|
|
assert(exec_size > 0);
|
2021-01-11 22:18:11 -06:00
|
|
|
const unsigned msg_type = bit_size == 32 ?
|
2021-03-29 15:16:59 -07:00
|
|
|
GFX9_DATAPORT_DC_PORT1_A64_UNTYPED_ATOMIC_FLOAT_OP :
|
|
|
|
|
GFX12_DATAPORT_DC_PORT1_A64_UNTYPED_ATOMIC_HALF_FLOAT_OP;
|
2018-11-26 15:15:04 -06:00
|
|
|
|
|
|
|
|
const unsigned msg_control =
|
|
|
|
|
SET_BITS(atomic_op, 1, 0) |
|
|
|
|
|
SET_BITS(response_expected, 5, 5);
|
|
|
|
|
|
2021-03-29 15:16:59 -07:00
|
|
|
return brw_dp_desc(devinfo, GFX8_BTI_STATELESS_NON_COHERENT,
|
2020-04-29 17:14:58 -05:00
|
|
|
msg_type, msg_control);
|
2018-11-26 15:15:04 -06:00
|
|
|
}
|
|
|
|
|
|
2018-10-29 16:09:30 -05:00
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_dp_typed_atomic_desc(const struct intel_device_info *devinfo,
|
2018-10-29 16:09:30 -05:00
|
|
|
unsigned exec_size,
|
|
|
|
|
unsigned exec_group,
|
|
|
|
|
unsigned atomic_op,
|
|
|
|
|
bool response_expected)
|
|
|
|
|
{
|
|
|
|
|
assert(exec_size > 0 || exec_group == 0);
|
|
|
|
|
assert(exec_group % 8 == 0);
|
|
|
|
|
|
2024-02-16 14:52:03 -08:00
|
|
|
const unsigned msg_type =
|
|
|
|
|
exec_size == 0 ? HSW_DATAPORT_DC_PORT1_TYPED_ATOMIC_OP_SIMD4X2 :
|
|
|
|
|
HSW_DATAPORT_DC_PORT1_TYPED_ATOMIC_OP;
|
2018-10-29 16:09:30 -05:00
|
|
|
|
|
|
|
|
const bool high_sample_mask = (exec_group / 8) % 2 == 1;
|
|
|
|
|
|
|
|
|
|
const unsigned msg_control =
|
|
|
|
|
SET_BITS(atomic_op, 3, 0) |
|
|
|
|
|
SET_BITS(high_sample_mask, 4, 4) |
|
|
|
|
|
SET_BITS(response_expected, 5, 5);
|
|
|
|
|
|
|
|
|
|
return brw_dp_surface_desc(devinfo, msg_type, msg_control);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_dp_typed_surface_rw_desc(const struct intel_device_info *devinfo,
|
2018-10-29 16:09:30 -05:00
|
|
|
unsigned exec_size,
|
|
|
|
|
unsigned exec_group,
|
|
|
|
|
unsigned num_channels,
|
|
|
|
|
bool write)
|
|
|
|
|
{
|
|
|
|
|
assert(exec_size > 0 || exec_group == 0);
|
|
|
|
|
assert(exec_group % 8 == 0);
|
|
|
|
|
|
|
|
|
|
/* Typed surface reads and writes don't support SIMD16 */
|
|
|
|
|
assert(exec_size <= 8);
|
|
|
|
|
|
2024-02-16 14:52:03 -08:00
|
|
|
const unsigned msg_type =
|
|
|
|
|
write ? HSW_DATAPORT_DC_PORT1_TYPED_SURFACE_WRITE :
|
|
|
|
|
HSW_DATAPORT_DC_PORT1_TYPED_SURFACE_READ;
|
2018-10-29 16:09:30 -05:00
|
|
|
|
|
|
|
|
/* See also MDC_SG3 in the SKL PRM Vol 2d. */
|
2024-02-16 14:52:03 -08:00
|
|
|
const unsigned slot_group = exec_size == 0 ? 0 : /* SIMD4x2 */
|
|
|
|
|
1 + ((exec_group / 8) % 2);
|
2018-10-29 16:09:30 -05:00
|
|
|
|
2024-02-16 14:52:03 -08:00
|
|
|
const unsigned msg_control =
|
|
|
|
|
SET_BITS(brw_mdc_cmask(num_channels), 3, 0) |
|
|
|
|
|
SET_BITS(slot_group, 5, 4);
|
2018-10-29 16:09:30 -05:00
|
|
|
|
|
|
|
|
return brw_dp_surface_desc(devinfo, msg_type, msg_control);
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-04 11:49:29 +02:00
|
|
|
static inline uint32_t
|
|
|
|
|
brw_fb_desc(const struct intel_device_info *devinfo,
|
|
|
|
|
unsigned binding_table_index,
|
|
|
|
|
unsigned msg_type,
|
|
|
|
|
unsigned msg_control)
|
|
|
|
|
{
|
2024-02-16 14:52:03 -08:00
|
|
|
return SET_BITS(binding_table_index, 7, 0) |
|
|
|
|
|
SET_BITS(msg_control, 13, 8) |
|
|
|
|
|
SET_BITS(msg_type, 17, 14);
|
2021-02-04 11:49:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned
|
|
|
|
|
brw_fb_desc_binding_table_index(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
|
uint32_t desc)
|
|
|
|
|
{
|
|
|
|
|
return GET_BITS(desc, 7, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline uint32_t
|
|
|
|
|
brw_fb_desc_msg_control(const struct intel_device_info *devinfo, uint32_t desc)
|
|
|
|
|
{
|
2024-02-16 14:52:03 -08:00
|
|
|
return GET_BITS(desc, 13, 8);
|
2021-02-04 11:49:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned
|
|
|
|
|
brw_fb_desc_msg_type(const struct intel_device_info *devinfo, uint32_t desc)
|
|
|
|
|
{
|
2024-02-16 14:52:03 -08:00
|
|
|
return GET_BITS(desc, 17, 14);
|
2021-02-04 11:49:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline uint32_t
|
|
|
|
|
brw_fb_read_desc(const struct intel_device_info *devinfo,
|
|
|
|
|
unsigned binding_table_index,
|
|
|
|
|
unsigned msg_control,
|
|
|
|
|
unsigned exec_size,
|
|
|
|
|
bool per_sample)
|
|
|
|
|
{
|
2021-05-03 09:50:44 -05:00
|
|
|
assert(exec_size == 8 || exec_size == 16);
|
|
|
|
|
|
2021-02-04 11:49:29 +02:00
|
|
|
return brw_fb_desc(devinfo, binding_table_index,
|
|
|
|
|
GFX9_DATAPORT_RC_RENDER_TARGET_READ, msg_control) |
|
|
|
|
|
SET_BITS(per_sample, 13, 13) |
|
2021-05-03 09:50:44 -05:00
|
|
|
SET_BITS(exec_size == 8, 8, 8) /* Render Target Message Subtype */;
|
2021-02-04 11:49:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline uint32_t
|
|
|
|
|
brw_fb_write_desc(const struct intel_device_info *devinfo,
|
|
|
|
|
unsigned binding_table_index,
|
|
|
|
|
unsigned msg_control,
|
2020-10-22 13:23:06 +03:00
|
|
|
bool last_render_target,
|
|
|
|
|
bool coarse_write)
|
2021-02-04 11:49:29 +02:00
|
|
|
{
|
2024-02-16 14:52:03 -08:00
|
|
|
const unsigned msg_type = GFX6_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE;
|
2021-02-04 11:49:29 +02:00
|
|
|
|
2020-10-22 13:23:06 +03:00
|
|
|
assert(devinfo->ver >= 10 || !coarse_write);
|
|
|
|
|
|
2024-02-16 14:52:03 -08:00
|
|
|
return brw_fb_desc(devinfo, binding_table_index, msg_type, msg_control) |
|
|
|
|
|
SET_BITS(last_render_target, 12, 12) |
|
|
|
|
|
SET_BITS(coarse_write, 18, 18);
|
2021-02-04 11:49:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
brw_fb_write_desc_last_render_target(const struct intel_device_info *devinfo,
|
|
|
|
|
uint32_t desc)
|
|
|
|
|
{
|
2024-02-16 14:52:03 -08:00
|
|
|
return GET_BITS(desc, 12, 12);
|
2021-02-04 11:49:29 +02:00
|
|
|
}
|
|
|
|
|
|
2020-10-22 13:23:06 +03:00
|
|
|
static inline bool
|
|
|
|
|
brw_fb_write_desc_coarse_write(const struct intel_device_info *devinfo,
|
|
|
|
|
uint32_t desc)
|
|
|
|
|
{
|
|
|
|
|
assert(devinfo->ver >= 10);
|
|
|
|
|
return GET_BITS(desc, 18, 18);
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-28 16:10:25 -07:00
|
|
|
static inline bool
|
|
|
|
|
lsc_opcode_has_cmask(enum lsc_opcode opcode)
|
|
|
|
|
{
|
|
|
|
|
return opcode == LSC_OP_LOAD_CMASK || opcode == LSC_OP_STORE_CMASK;
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-20 18:44:15 -05:00
|
|
|
static inline bool
|
|
|
|
|
lsc_opcode_has_transpose(enum lsc_opcode opcode)
|
|
|
|
|
{
|
|
|
|
|
return opcode == LSC_OP_LOAD || opcode == LSC_OP_STORE;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-16 08:08:43 +00:00
|
|
|
static inline bool
|
|
|
|
|
lsc_opcode_is_store(enum lsc_opcode opcode)
|
|
|
|
|
{
|
|
|
|
|
return opcode == LSC_OP_STORE ||
|
|
|
|
|
opcode == LSC_OP_STORE_CMASK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
lsc_opcode_is_atomic(enum lsc_opcode opcode)
|
|
|
|
|
{
|
|
|
|
|
switch (opcode) {
|
|
|
|
|
case LSC_OP_ATOMIC_INC:
|
|
|
|
|
case LSC_OP_ATOMIC_DEC:
|
|
|
|
|
case LSC_OP_ATOMIC_LOAD:
|
|
|
|
|
case LSC_OP_ATOMIC_STORE:
|
|
|
|
|
case LSC_OP_ATOMIC_ADD:
|
|
|
|
|
case LSC_OP_ATOMIC_SUB:
|
|
|
|
|
case LSC_OP_ATOMIC_MIN:
|
|
|
|
|
case LSC_OP_ATOMIC_MAX:
|
|
|
|
|
case LSC_OP_ATOMIC_UMIN:
|
|
|
|
|
case LSC_OP_ATOMIC_UMAX:
|
|
|
|
|
case LSC_OP_ATOMIC_CMPXCHG:
|
|
|
|
|
case LSC_OP_ATOMIC_FADD:
|
|
|
|
|
case LSC_OP_ATOMIC_FSUB:
|
|
|
|
|
case LSC_OP_ATOMIC_FMIN:
|
|
|
|
|
case LSC_OP_ATOMIC_FMAX:
|
|
|
|
|
case LSC_OP_ATOMIC_FCMPXCHG:
|
|
|
|
|
case LSC_OP_ATOMIC_AND:
|
|
|
|
|
case LSC_OP_ATOMIC_OR:
|
|
|
|
|
case LSC_OP_ATOMIC_XOR:
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-09 15:02:44 -08:00
|
|
|
static inline bool
|
|
|
|
|
lsc_opcode_is_atomic_float(enum lsc_opcode opcode)
|
|
|
|
|
{
|
|
|
|
|
switch (opcode) {
|
|
|
|
|
case LSC_OP_ATOMIC_FADD:
|
|
|
|
|
case LSC_OP_ATOMIC_FSUB:
|
|
|
|
|
case LSC_OP_ATOMIC_FMIN:
|
|
|
|
|
case LSC_OP_ATOMIC_FMAX:
|
|
|
|
|
case LSC_OP_ATOMIC_FCMPXCHG:
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-09 15:37:30 -08:00
|
|
|
static inline unsigned
|
|
|
|
|
lsc_op_num_data_values(unsigned _op)
|
|
|
|
|
{
|
|
|
|
|
enum lsc_opcode op = (enum lsc_opcode) _op;
|
|
|
|
|
|
|
|
|
|
switch (op) {
|
|
|
|
|
case LSC_OP_ATOMIC_CMPXCHG:
|
|
|
|
|
case LSC_OP_ATOMIC_FCMPXCHG:
|
|
|
|
|
return 2;
|
|
|
|
|
case LSC_OP_ATOMIC_INC:
|
|
|
|
|
case LSC_OP_ATOMIC_DEC:
|
|
|
|
|
case LSC_OP_LOAD:
|
|
|
|
|
case LSC_OP_LOAD_CMASK:
|
|
|
|
|
case LSC_OP_FENCE:
|
|
|
|
|
/* XXX: actually check docs */
|
|
|
|
|
return 0;
|
|
|
|
|
default:
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-09 14:17:09 -08:00
|
|
|
static inline unsigned
|
|
|
|
|
lsc_op_to_legacy_atomic(unsigned _op)
|
|
|
|
|
{
|
|
|
|
|
enum lsc_opcode op = (enum lsc_opcode) _op;
|
|
|
|
|
|
|
|
|
|
switch (op) {
|
|
|
|
|
case LSC_OP_ATOMIC_INC:
|
|
|
|
|
return BRW_AOP_INC;
|
|
|
|
|
case LSC_OP_ATOMIC_DEC:
|
|
|
|
|
return BRW_AOP_DEC;
|
|
|
|
|
case LSC_OP_ATOMIC_STORE:
|
|
|
|
|
return BRW_AOP_MOV;
|
|
|
|
|
case LSC_OP_ATOMIC_ADD:
|
|
|
|
|
return BRW_AOP_ADD;
|
|
|
|
|
case LSC_OP_ATOMIC_SUB:
|
|
|
|
|
return BRW_AOP_SUB;
|
|
|
|
|
case LSC_OP_ATOMIC_MIN:
|
|
|
|
|
return BRW_AOP_IMIN;
|
|
|
|
|
case LSC_OP_ATOMIC_MAX:
|
|
|
|
|
return BRW_AOP_IMAX;
|
|
|
|
|
case LSC_OP_ATOMIC_UMIN:
|
|
|
|
|
return BRW_AOP_UMIN;
|
|
|
|
|
case LSC_OP_ATOMIC_UMAX:
|
|
|
|
|
return BRW_AOP_UMAX;
|
|
|
|
|
case LSC_OP_ATOMIC_CMPXCHG:
|
|
|
|
|
return BRW_AOP_CMPWR;
|
|
|
|
|
case LSC_OP_ATOMIC_FADD:
|
|
|
|
|
return BRW_AOP_FADD;
|
|
|
|
|
case LSC_OP_ATOMIC_FMIN:
|
|
|
|
|
return BRW_AOP_FMIN;
|
|
|
|
|
case LSC_OP_ATOMIC_FMAX:
|
|
|
|
|
return BRW_AOP_FMAX;
|
|
|
|
|
case LSC_OP_ATOMIC_FCMPXCHG:
|
|
|
|
|
return BRW_AOP_FCMPWR;
|
|
|
|
|
case LSC_OP_ATOMIC_AND:
|
|
|
|
|
return BRW_AOP_AND;
|
|
|
|
|
case LSC_OP_ATOMIC_OR:
|
|
|
|
|
return BRW_AOP_OR;
|
|
|
|
|
case LSC_OP_ATOMIC_XOR:
|
|
|
|
|
return BRW_AOP_XOR;
|
|
|
|
|
/* No LSC op maps to BRW_AOP_PREDEC */
|
|
|
|
|
case LSC_OP_ATOMIC_LOAD:
|
|
|
|
|
case LSC_OP_ATOMIC_FSUB:
|
|
|
|
|
unreachable("no corresponding legacy atomic operation");
|
|
|
|
|
case LSC_OP_LOAD:
|
|
|
|
|
case LSC_OP_LOAD_CMASK:
|
|
|
|
|
case LSC_OP_STORE:
|
|
|
|
|
case LSC_OP_STORE_CMASK:
|
|
|
|
|
case LSC_OP_FENCE:
|
|
|
|
|
unreachable("not an atomic op");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unreachable("invalid LSC op");
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-28 16:10:25 -07:00
|
|
|
static inline uint32_t
|
|
|
|
|
lsc_data_size_bytes(enum lsc_data_size data_size)
|
|
|
|
|
{
|
|
|
|
|
switch (data_size) {
|
|
|
|
|
case LSC_DATA_SIZE_D8:
|
|
|
|
|
return 1;
|
|
|
|
|
case LSC_DATA_SIZE_D16:
|
|
|
|
|
return 2;
|
|
|
|
|
case LSC_DATA_SIZE_D32:
|
|
|
|
|
case LSC_DATA_SIZE_D8U32:
|
|
|
|
|
case LSC_DATA_SIZE_D16U32:
|
|
|
|
|
case LSC_DATA_SIZE_D16BF32:
|
|
|
|
|
return 4;
|
|
|
|
|
case LSC_DATA_SIZE_D64:
|
|
|
|
|
return 8;
|
|
|
|
|
default:
|
|
|
|
|
unreachable("Unsupported data payload size.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline uint32_t
|
|
|
|
|
lsc_addr_size_bytes(enum lsc_addr_size addr_size)
|
|
|
|
|
{
|
|
|
|
|
switch (addr_size) {
|
|
|
|
|
case LSC_ADDR_SIZE_A16: return 2;
|
|
|
|
|
case LSC_ADDR_SIZE_A32: return 4;
|
|
|
|
|
case LSC_ADDR_SIZE_A64: return 8;
|
|
|
|
|
default:
|
|
|
|
|
unreachable("Unsupported address size.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline uint32_t
|
|
|
|
|
lsc_vector_length(enum lsc_vect_size vect_size)
|
|
|
|
|
{
|
|
|
|
|
switch (vect_size) {
|
|
|
|
|
case LSC_VECT_SIZE_V1: return 1;
|
|
|
|
|
case LSC_VECT_SIZE_V2: return 2;
|
|
|
|
|
case LSC_VECT_SIZE_V3: return 3;
|
|
|
|
|
case LSC_VECT_SIZE_V4: return 4;
|
|
|
|
|
case LSC_VECT_SIZE_V8: return 8;
|
|
|
|
|
case LSC_VECT_SIZE_V16: return 16;
|
|
|
|
|
case LSC_VECT_SIZE_V32: return 32;
|
|
|
|
|
case LSC_VECT_SIZE_V64: return 64;
|
|
|
|
|
default:
|
|
|
|
|
unreachable("Unsupported size of vector");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline enum lsc_vect_size
|
|
|
|
|
lsc_vect_size(unsigned vect_size)
|
|
|
|
|
{
|
|
|
|
|
switch(vect_size) {
|
|
|
|
|
case 1: return LSC_VECT_SIZE_V1;
|
|
|
|
|
case 2: return LSC_VECT_SIZE_V2;
|
|
|
|
|
case 3: return LSC_VECT_SIZE_V3;
|
|
|
|
|
case 4: return LSC_VECT_SIZE_V4;
|
|
|
|
|
case 8: return LSC_VECT_SIZE_V8;
|
|
|
|
|
case 16: return LSC_VECT_SIZE_V16;
|
|
|
|
|
case 32: return LSC_VECT_SIZE_V32;
|
|
|
|
|
case 64: return LSC_VECT_SIZE_V64;
|
|
|
|
|
default:
|
|
|
|
|
unreachable("Unsupported vector size for dataport");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline uint32_t
|
2024-08-05 21:05:07 -07:00
|
|
|
lsc_msg_desc(const struct intel_device_info *devinfo,
|
2022-09-29 12:38:19 -07:00
|
|
|
enum lsc_opcode opcode,
|
2020-07-28 16:10:25 -07:00
|
|
|
enum lsc_addr_surface_type addr_type,
|
2022-09-29 12:38:19 -07:00
|
|
|
enum lsc_addr_size addr_sz,
|
2024-08-05 21:05:07 -07:00
|
|
|
enum lsc_data_size data_sz, unsigned num_channels_or_cmask,
|
|
|
|
|
bool transpose, unsigned cache_ctrl)
|
2020-07-28 16:10:25 -07:00
|
|
|
{
|
|
|
|
|
assert(devinfo->has_lsc);
|
2021-07-20 18:44:15 -05:00
|
|
|
assert(!transpose || lsc_opcode_has_transpose(opcode));
|
|
|
|
|
|
2020-07-28 16:10:25 -07:00
|
|
|
unsigned msg_desc =
|
|
|
|
|
SET_BITS(opcode, 5, 0) |
|
|
|
|
|
SET_BITS(addr_sz, 8, 7) |
|
|
|
|
|
SET_BITS(data_sz, 11, 9) |
|
|
|
|
|
SET_BITS(transpose, 15, 15) |
|
2022-07-28 18:48:25 +02:00
|
|
|
(devinfo->ver >= 20 ? SET_BITS(cache_ctrl, 19, 16) :
|
|
|
|
|
SET_BITS(cache_ctrl, 19, 17)) |
|
2020-07-28 16:10:25 -07:00
|
|
|
SET_BITS(addr_type, 30, 29);
|
|
|
|
|
|
|
|
|
|
if (lsc_opcode_has_cmask(opcode))
|
2024-08-05 21:05:07 -07:00
|
|
|
msg_desc |= SET_BITS(num_channels_or_cmask, 15, 12);
|
2020-07-28 16:10:25 -07:00
|
|
|
else
|
2024-08-05 21:05:07 -07:00
|
|
|
msg_desc |= SET_BITS(lsc_vect_size(num_channels_or_cmask), 14, 12);
|
2020-07-28 16:10:25 -07:00
|
|
|
|
|
|
|
|
return msg_desc;
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-12 13:20:44 -08:00
|
|
|
static inline enum lsc_opcode
|
|
|
|
|
lsc_msg_desc_opcode(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
|
uint32_t desc)
|
|
|
|
|
{
|
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
|
return (enum lsc_opcode) GET_BITS(desc, 5, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline enum lsc_addr_size
|
|
|
|
|
lsc_msg_desc_addr_size(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
|
uint32_t desc)
|
|
|
|
|
{
|
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
|
return (enum lsc_addr_size) GET_BITS(desc, 8, 7);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline enum lsc_data_size
|
|
|
|
|
lsc_msg_desc_data_size(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
|
uint32_t desc)
|
|
|
|
|
{
|
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
|
return (enum lsc_data_size) GET_BITS(desc, 11, 9);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline enum lsc_vect_size
|
|
|
|
|
lsc_msg_desc_vect_size(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
|
uint32_t desc)
|
|
|
|
|
{
|
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
|
assert(!lsc_opcode_has_cmask(lsc_msg_desc_opcode(devinfo, desc)));
|
|
|
|
|
return (enum lsc_vect_size) GET_BITS(desc, 14, 12);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline enum lsc_cmask
|
|
|
|
|
lsc_msg_desc_cmask(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
|
uint32_t desc)
|
|
|
|
|
{
|
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
|
assert(lsc_opcode_has_cmask(lsc_msg_desc_opcode(devinfo, desc)));
|
|
|
|
|
return (enum lsc_cmask) GET_BITS(desc, 15, 12);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
lsc_msg_desc_transpose(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
|
uint32_t desc)
|
|
|
|
|
{
|
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
|
return GET_BITS(desc, 15, 15);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned
|
|
|
|
|
lsc_msg_desc_cache_ctrl(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
|
uint32_t desc)
|
|
|
|
|
{
|
|
|
|
|
assert(devinfo->has_lsc);
|
2022-07-28 18:48:25 +02:00
|
|
|
return devinfo->ver >= 20 ? GET_BITS(desc, 19, 16) : GET_BITS(desc, 19, 17);
|
2021-02-12 13:20:44 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned
|
2022-09-28 16:17:02 -07:00
|
|
|
lsc_msg_dest_len(const struct intel_device_info *devinfo,
|
|
|
|
|
enum lsc_data_size data_sz, unsigned n)
|
2021-02-12 13:20:44 -08:00
|
|
|
{
|
2022-09-28 16:17:02 -07:00
|
|
|
return DIV_ROUND_UP(lsc_data_size_bytes(data_sz) * n,
|
|
|
|
|
reg_unit(devinfo) * REG_SIZE) * reg_unit(devinfo);
|
2021-02-12 13:20:44 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned
|
2022-09-28 16:17:02 -07:00
|
|
|
lsc_msg_addr_len(const struct intel_device_info *devinfo,
|
|
|
|
|
enum lsc_addr_size addr_sz, unsigned n)
|
2021-02-12 13:20:44 -08:00
|
|
|
{
|
2022-09-28 16:17:02 -07:00
|
|
|
return DIV_ROUND_UP(lsc_addr_size_bytes(addr_sz) * n,
|
|
|
|
|
reg_unit(devinfo) * REG_SIZE) * reg_unit(devinfo);
|
2021-02-12 13:20:44 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline enum lsc_addr_surface_type
|
|
|
|
|
lsc_msg_desc_addr_type(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
|
uint32_t desc)
|
|
|
|
|
{
|
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
|
return (enum lsc_addr_surface_type) GET_BITS(desc, 30, 29);
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-11 18:33:05 -07:00
|
|
|
static inline uint32_t
|
|
|
|
|
lsc_fence_msg_desc(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
|
enum lsc_fence_scope scope,
|
|
|
|
|
enum lsc_flush_type flush_type,
|
|
|
|
|
bool route_to_lsc)
|
|
|
|
|
{
|
|
|
|
|
assert(devinfo->has_lsc);
|
2023-08-01 11:02:31 +03:00
|
|
|
|
|
|
|
|
#if INTEL_NEEDS_WA_22017182272
|
|
|
|
|
assert(flush_type != LSC_FLUSH_TYPE_DISCARD);
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-07-11 18:33:05 -07:00
|
|
|
return SET_BITS(LSC_OP_FENCE, 5, 0) |
|
|
|
|
|
SET_BITS(LSC_ADDR_SIZE_A32, 8, 7) |
|
|
|
|
|
SET_BITS(scope, 11, 9) |
|
|
|
|
|
SET_BITS(flush_type, 14, 12) |
|
|
|
|
|
SET_BITS(route_to_lsc, 18, 18) |
|
|
|
|
|
SET_BITS(LSC_ADDR_SURFTYPE_FLAT, 30, 29);
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-12 13:20:44 -08:00
|
|
|
static inline enum lsc_fence_scope
|
|
|
|
|
lsc_fence_msg_desc_scope(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
|
uint32_t desc)
|
|
|
|
|
{
|
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
|
return (enum lsc_fence_scope) GET_BITS(desc, 11, 9);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline enum lsc_flush_type
|
|
|
|
|
lsc_fence_msg_desc_flush_type(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
|
uint32_t desc)
|
|
|
|
|
{
|
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
|
return (enum lsc_flush_type) GET_BITS(desc, 14, 12);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline enum lsc_backup_fence_routing
|
|
|
|
|
lsc_fence_msg_desc_backup_routing(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
|
uint32_t desc)
|
|
|
|
|
{
|
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
|
return (enum lsc_backup_fence_routing) GET_BITS(desc, 18, 18);
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-28 16:10:25 -07:00
|
|
|
static inline uint32_t
|
|
|
|
|
lsc_bti_ex_desc(const struct intel_device_info *devinfo, unsigned bti)
|
|
|
|
|
{
|
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
|
return SET_BITS(bti, 31, 24) |
|
|
|
|
|
SET_BITS(0, 23, 12); /* base offset */
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-12 13:20:44 -08:00
|
|
|
static inline unsigned
|
|
|
|
|
lsc_bti_ex_desc_base_offset(const struct intel_device_info *devinfo,
|
|
|
|
|
uint32_t ex_desc)
|
|
|
|
|
{
|
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
|
return GET_BITS(ex_desc, 23, 12);
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-28 16:10:25 -07:00
|
|
|
static inline unsigned
|
|
|
|
|
lsc_bti_ex_desc_index(const struct intel_device_info *devinfo,
|
|
|
|
|
uint32_t ex_desc)
|
|
|
|
|
{
|
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
|
return GET_BITS(ex_desc, 31, 24);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned
|
|
|
|
|
lsc_flat_ex_desc_base_offset(const struct intel_device_info *devinfo,
|
|
|
|
|
uint32_t ex_desc)
|
|
|
|
|
{
|
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
|
return GET_BITS(ex_desc, 31, 12);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline uint32_t
|
|
|
|
|
lsc_bss_ex_desc(const struct intel_device_info *devinfo,
|
|
|
|
|
unsigned surface_state_index)
|
|
|
|
|
{
|
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
|
return SET_BITS(surface_state_index, 31, 6);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned
|
|
|
|
|
lsc_bss_ex_desc_index(const struct intel_device_info *devinfo,
|
|
|
|
|
uint32_t ex_desc)
|
|
|
|
|
{
|
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
|
return GET_BITS(ex_desc, 31, 6);
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-21 14:46:50 -05:00
|
|
|
static inline uint32_t
|
|
|
|
|
brw_mdc_sm2(unsigned exec_size)
|
|
|
|
|
{
|
|
|
|
|
assert(exec_size == 8 || exec_size == 16);
|
|
|
|
|
return exec_size > 8;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline uint32_t
|
|
|
|
|
brw_mdc_sm2_exec_size(uint32_t sm2)
|
|
|
|
|
{
|
|
|
|
|
assert(sm2 <= 1);
|
|
|
|
|
return 8 << sm2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_btd_spawn_desc(ASSERTED const struct intel_device_info *devinfo,
|
2020-10-21 14:46:50 -05:00
|
|
|
unsigned exec_size, unsigned msg_type)
|
|
|
|
|
{
|
|
|
|
|
assert(devinfo->has_ray_tracing);
|
2023-02-17 10:18:36 -08:00
|
|
|
assert(devinfo->ver < 20 || exec_size == 16);
|
2020-10-21 14:46:50 -05:00
|
|
|
|
|
|
|
|
return SET_BITS(0, 19, 19) | /* No header */
|
|
|
|
|
SET_BITS(msg_type, 17, 14) |
|
|
|
|
|
SET_BITS(brw_mdc_sm2(exec_size), 8, 8);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_btd_spawn_msg_type(UNUSED const struct intel_device_info *devinfo,
|
2020-10-21 14:46:50 -05:00
|
|
|
uint32_t desc)
|
|
|
|
|
{
|
|
|
|
|
return GET_BITS(desc, 17, 14);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_btd_spawn_exec_size(UNUSED const struct intel_device_info *devinfo,
|
2020-10-21 14:46:50 -05:00
|
|
|
uint32_t desc)
|
2020-08-06 15:45:45 -05:00
|
|
|
{
|
|
|
|
|
return brw_mdc_sm2_exec_size(GET_BITS(desc, 8, 8));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_rt_trace_ray_desc(ASSERTED const struct intel_device_info *devinfo,
|
2020-08-06 15:45:45 -05:00
|
|
|
unsigned exec_size)
|
|
|
|
|
{
|
|
|
|
|
assert(devinfo->has_ray_tracing);
|
2023-02-17 10:18:36 -08:00
|
|
|
assert(devinfo->ver < 20 || exec_size == 16);
|
2020-08-06 15:45:45 -05:00
|
|
|
|
|
|
|
|
return SET_BITS(0, 19, 19) | /* No header */
|
|
|
|
|
SET_BITS(0, 17, 14) | /* Message type */
|
|
|
|
|
SET_BITS(brw_mdc_sm2(exec_size), 8, 8);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_rt_trace_ray_desc_exec_size(UNUSED const struct intel_device_info *devinfo,
|
2020-08-06 15:45:45 -05:00
|
|
|
uint32_t desc)
|
2020-10-21 14:46:50 -05:00
|
|
|
{
|
|
|
|
|
return brw_mdc_sm2_exec_size(GET_BITS(desc, 8, 8));
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-09 16:16:16 -07:00
|
|
|
/**
|
|
|
|
|
* Construct a message descriptor immediate with the specified pixel
|
|
|
|
|
* interpolator function controls.
|
|
|
|
|
*/
|
|
|
|
|
static inline uint32_t
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_pixel_interp_desc(UNUSED const struct intel_device_info *devinfo,
|
2018-07-09 16:16:16 -07:00
|
|
|
unsigned msg_type,
|
|
|
|
|
bool noperspective,
|
2020-10-22 13:23:06 +03:00
|
|
|
bool coarse_pixel_rate,
|
2021-11-19 17:57:42 -06:00
|
|
|
unsigned exec_size,
|
|
|
|
|
unsigned group)
|
2018-07-09 16:16:16 -07:00
|
|
|
{
|
2021-11-19 17:57:42 -06:00
|
|
|
assert(exec_size == 8 || exec_size == 16);
|
|
|
|
|
const bool simd_mode = exec_size == 16;
|
|
|
|
|
const bool slot_group = group >= 16;
|
|
|
|
|
|
2020-10-22 13:23:06 +03:00
|
|
|
assert(devinfo->ver >= 10 || !coarse_pixel_rate);
|
2018-07-09 16:16:16 -07:00
|
|
|
return (SET_BITS(slot_group, 11, 11) |
|
|
|
|
|
SET_BITS(msg_type, 13, 12) |
|
|
|
|
|
SET_BITS(!!noperspective, 14, 14) |
|
2020-10-22 13:23:06 +03:00
|
|
|
SET_BITS(coarse_pixel_rate, 15, 15) |
|
2018-07-09 16:16:16 -07:00
|
|
|
SET_BITS(simd_mode, 16, 16));
|
|
|
|
|
}
|
|
|
|
|
|
i965: Factor out logic to build a send message instruction with indirect descriptor.
This is going to be useful because the Gen7+ uniform and varying pull
constant, texturing, typed and untyped surface read, write, and atomic
generation code on the vec4 and fs back-end all require the same logic
to handle conditionally indirect surface indices. In pseudocode:
| if (surface.file == BRW_IMMEDIATE_VALUE) {
| inst = brw_SEND(p, dst, payload);
| set_descriptor_control_bits(inst, surface, ...);
| } else {
| inst = brw_OR(p, addr, surface, 0);
| set_descriptor_control_bits(inst, ...);
| inst = brw_SEND(p, dst, payload);
| set_indirect_send_descriptor(inst, addr);
| }
This patch abstracts out this frequently recurring pattern so we can
now write:
| inst = brw_send_indirect_message(p, sfid, dst, payload, surface)
| set_descriptor_control_bits(inst, ...);
without worrying about handling the immediate and indirect surface
index cases explicitly.
v2: Rebase. Improve documentatation and commit message. (Topi)
Preserve UW destination type cargo-cult. (Topi, Ken, Matt)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2015-03-19 15:44:24 +02:00
|
|
|
/**
|
|
|
|
|
* Send message to shared unit \p sfid with a possibly indirect descriptor \p
|
|
|
|
|
* desc. If \p desc is not an immediate it will be transparently loaded to an
|
2018-06-02 15:08:18 -07:00
|
|
|
* address register using an OR instruction.
|
i965: Factor out logic to build a send message instruction with indirect descriptor.
This is going to be useful because the Gen7+ uniform and varying pull
constant, texturing, typed and untyped surface read, write, and atomic
generation code on the vec4 and fs back-end all require the same logic
to handle conditionally indirect surface indices. In pseudocode:
| if (surface.file == BRW_IMMEDIATE_VALUE) {
| inst = brw_SEND(p, dst, payload);
| set_descriptor_control_bits(inst, surface, ...);
| } else {
| inst = brw_OR(p, addr, surface, 0);
| set_descriptor_control_bits(inst, ...);
| inst = brw_SEND(p, dst, payload);
| set_indirect_send_descriptor(inst, addr);
| }
This patch abstracts out this frequently recurring pattern so we can
now write:
| inst = brw_send_indirect_message(p, sfid, dst, payload, surface)
| set_descriptor_control_bits(inst, ...);
without worrying about handling the immediate and indirect surface
index cases explicitly.
v2: Rebase. Improve documentatation and commit message. (Topi)
Preserve UW destination type cargo-cult. (Topi, Ken, Matt)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2015-03-19 15:44:24 +02:00
|
|
|
*/
|
2018-06-02 15:08:18 -07:00
|
|
|
void
|
2015-04-16 11:06:57 -07:00
|
|
|
brw_send_indirect_message(struct brw_codegen *p,
|
i965: Factor out logic to build a send message instruction with indirect descriptor.
This is going to be useful because the Gen7+ uniform and varying pull
constant, texturing, typed and untyped surface read, write, and atomic
generation code on the vec4 and fs back-end all require the same logic
to handle conditionally indirect surface indices. In pseudocode:
| if (surface.file == BRW_IMMEDIATE_VALUE) {
| inst = brw_SEND(p, dst, payload);
| set_descriptor_control_bits(inst, surface, ...);
| } else {
| inst = brw_OR(p, addr, surface, 0);
| set_descriptor_control_bits(inst, ...);
| inst = brw_SEND(p, dst, payload);
| set_indirect_send_descriptor(inst, addr);
| }
This patch abstracts out this frequently recurring pattern so we can
now write:
| inst = brw_send_indirect_message(p, sfid, dst, payload, surface)
| set_descriptor_control_bits(inst, ...);
without worrying about handling the immediate and indirect surface
index cases explicitly.
v2: Rebase. Improve documentatation and commit message. (Topi)
Preserve UW destination type cargo-cult. (Topi, Ken, Matt)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2015-03-19 15:44:24 +02:00
|
|
|
unsigned sfid,
|
|
|
|
|
struct brw_reg dst,
|
|
|
|
|
struct brw_reg payload,
|
2018-06-02 15:07:31 -07:00
|
|
|
struct brw_reg desc,
|
2024-11-20 08:12:52 -08:00
|
|
|
bool eot,
|
|
|
|
|
bool gather);
|
i965: Factor out logic to build a send message instruction with indirect descriptor.
This is going to be useful because the Gen7+ uniform and varying pull
constant, texturing, typed and untyped surface read, write, and atomic
generation code on the vec4 and fs back-end all require the same logic
to handle conditionally indirect surface indices. In pseudocode:
| if (surface.file == BRW_IMMEDIATE_VALUE) {
| inst = brw_SEND(p, dst, payload);
| set_descriptor_control_bits(inst, surface, ...);
| } else {
| inst = brw_OR(p, addr, surface, 0);
| set_descriptor_control_bits(inst, ...);
| inst = brw_SEND(p, dst, payload);
| set_indirect_send_descriptor(inst, addr);
| }
This patch abstracts out this frequently recurring pattern so we can
now write:
| inst = brw_send_indirect_message(p, sfid, dst, payload, surface)
| set_descriptor_control_bits(inst, ...);
without worrying about handling the immediate and indirect surface
index cases explicitly.
v2: Rebase. Improve documentatation and commit message. (Topi)
Preserve UW destination type cargo-cult. (Topi, Ken, Matt)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2015-03-19 15:44:24 +02:00
|
|
|
|
2018-11-15 15:17:06 -06:00
|
|
|
void
|
|
|
|
|
brw_send_indirect_split_message(struct brw_codegen *p,
|
|
|
|
|
unsigned sfid,
|
|
|
|
|
struct brw_reg dst,
|
|
|
|
|
struct brw_reg payload0,
|
|
|
|
|
struct brw_reg payload1,
|
|
|
|
|
struct brw_reg desc,
|
|
|
|
|
struct brw_reg ex_desc,
|
brw: move final send lowering up into the IR
Because we do emit the final send message form in code generation, a
lot of emissions look like this :
add(8) vgrf0, u0, 0x100
mov(1) a0.1, vgrf0 # emitted by the generator
send(8) ..., a0.1
By moving address register manipulation in the IR, we can get this
down to :
add(1) a0.1, u0, 0x100
send(8) ..., a0.1
This reduce register pressure around some send messages by 1 vgrf.
All lost shaders in the below results are fragment SIMD32, due to the
throughput estimator. If turned off, we loose no SIMD32 shaders with
this change.
DG2 results:
Assassin's Creed Valhalla:
Totals from 2044 (96.87% of 2110) affected shaders:
Instrs: 852879 -> 832044 (-2.44%); split: -2.45%, +0.00%
Subgroup size: 23832 -> 23824 (-0.03%)
Cycle count: 53345742 -> 52144277 (-2.25%); split: -5.08%, +2.82%
Spill count: 729 -> 554 (-24.01%); split: -28.40%, +4.39%
Fill count: 2005 -> 1256 (-37.36%)
Scratch Memory Size: 25600 -> 19456 (-24.00%); split: -32.00%, +8.00%
Max live registers: 116765 -> 115058 (-1.46%)
Max dispatch width: 19152 -> 18872 (-1.46%); split: +0.21%, -1.67%
Cyberpunk 2077:
Totals from 1181 (93.43% of 1264) affected shaders:
Instrs: 667192 -> 663615 (-0.54%); split: -0.55%, +0.01%
Subgroup size: 13016 -> 13032 (+0.12%)
Cycle count: 17383539 -> 17986073 (+3.47%); split: -0.93%, +4.39%
Spill count: 12 -> 8 (-33.33%)
Fill count: 9 -> 6 (-33.33%)
Dota2:
Totals from 173 (11.59% of 1493) affected shaders:
Cycle count: 274403 -> 280817 (+2.34%); split: -0.01%, +2.34%
Max live registers: 5787 -> 5779 (-0.14%)
Max dispatch width: 1344 -> 1152 (-14.29%)
Hitman3:
Totals from 5072 (95.39% of 5317) affected shaders:
Instrs: 2879952 -> 2841804 (-1.32%); split: -1.32%, +0.00%
Cycle count: 153208505 -> 165860401 (+8.26%); split: -2.22%, +10.48%
Spill count: 3942 -> 3200 (-18.82%)
Fill count: 10158 -> 8846 (-12.92%)
Scratch Memory Size: 257024 -> 223232 (-13.15%)
Max live registers: 328467 -> 324631 (-1.17%)
Max dispatch width: 43928 -> 42768 (-2.64%); split: +0.09%, -2.73%
Fortnite:
Totals from 360 (4.82% of 7472) affected shaders:
Instrs: 778068 -> 777925 (-0.02%)
Subgroup size: 3128 -> 3136 (+0.26%)
Cycle count: 38684183 -> 38734579 (+0.13%); split: -0.06%, +0.19%
Max live registers: 50689 -> 50658 (-0.06%)
Hogwarts Legacy:
Totals from 1376 (84.00% of 1638) affected shaders:
Instrs: 758810 -> 749727 (-1.20%); split: -1.23%, +0.03%
Cycle count: 27778983 -> 28805469 (+3.70%); split: -1.42%, +5.12%
Spill count: 2475 -> 2299 (-7.11%); split: -7.47%, +0.36%
Fill count: 2677 -> 2445 (-8.67%); split: -9.90%, +1.23%
Scratch Memory Size: 99328 -> 89088 (-10.31%)
Max live registers: 84969 -> 84671 (-0.35%); split: -0.58%, +0.23%
Max dispatch width: 11848 -> 11920 (+0.61%)
Metro Exodus:
Totals from 92 (0.21% of 43072) affected shaders:
Instrs: 262995 -> 262968 (-0.01%)
Cycle count: 13818007 -> 13851266 (+0.24%); split: -0.01%, +0.25%
Max live registers: 11152 -> 11140 (-0.11%)
Red Dead Redemption 2 :
Totals from 451 (7.71% of 5847) affected shaders:
Instrs: 754178 -> 753811 (-0.05%); split: -0.05%, +0.00%
Cycle count: 3484078523 -> 3484111965 (+0.00%); split: -0.00%, +0.00%
Max live registers: 42294 -> 42185 (-0.26%)
Spiderman Remastered:
Totals from 6820 (98.02% of 6958) affected shaders:
Instrs: 6921500 -> 6747933 (-2.51%); split: -4.16%, +1.65%
Cycle count: 234400692460 -> 236846720707 (+1.04%); split: -0.20%, +1.25%
Spill count: 72971 -> 72622 (-0.48%); split: -8.08%, +7.61%
Fill count: 212921 -> 198483 (-6.78%); split: -12.37%, +5.58%
Scratch Memory Size: 3491840 -> 3410944 (-2.32%); split: -12.05%, +9.74%
Max live registers: 493149 -> 487458 (-1.15%)
Max dispatch width: 56936 -> 56856 (-0.14%); split: +0.06%, -0.20%
Strange Brigade:
Totals from 3769 (91.21% of 4132) affected shaders:
Instrs: 1354476 -> 1321474 (-2.44%)
Cycle count: 25351530 -> 25339190 (-0.05%); split: -1.64%, +1.59%
Max live registers: 199057 -> 193656 (-2.71%)
Max dispatch width: 30272 -> 30240 (-0.11%)
Witcher 3:
Totals from 25 (2.40% of 1041) affected shaders:
Instrs: 24621 -> 24606 (-0.06%)
Cycle count: 2218793 -> 2217503 (-0.06%); split: -0.11%, +0.05%
Max live registers: 1963 -> 1955 (-0.41%)
LNL results:
Assassin's Creed Valhalla:
Totals from 1928 (98.02% of 1967) affected shaders:
Instrs: 856107 -> 835756 (-2.38%); split: -2.48%, +0.11%
Subgroup size: 41264 -> 41280 (+0.04%)
Cycle count: 64606590 -> 62371700 (-3.46%); split: -5.57%, +2.11%
Spill count: 915 -> 669 (-26.89%); split: -32.79%, +5.90%
Fill count: 2414 -> 1617 (-33.02%); split: -36.62%, +3.60%
Scratch Memory Size: 62464 -> 44032 (-29.51%); split: -36.07%, +6.56%
Max live registers: 205483 -> 202192 (-1.60%)
Cyberpunk 2077:
Totals from 1177 (96.40% of 1221) affected shaders:
Instrs: 682237 -> 678931 (-0.48%); split: -0.51%, +0.03%
Subgroup size: 24912 -> 24944 (+0.13%)
Cycle count: 24355928 -> 25089292 (+3.01%); split: -0.80%, +3.81%
Spill count: 8 -> 3 (-62.50%)
Fill count: 6 -> 3 (-50.00%)
Max live registers: 126922 -> 125472 (-1.14%)
Dota2:
Totals from 428 (32.47% of 1318) affected shaders:
Instrs: 89355 -> 89740 (+0.43%)
Cycle count: 1152412 -> 1152706 (+0.03%); split: -0.52%, +0.55%
Max live registers: 32863 -> 32847 (-0.05%)
Fortnite:
Totals from 5354 (81.72% of 6552) affected shaders:
Instrs: 4135059 -> 4239015 (+2.51%); split: -0.01%, +2.53%
Cycle count: 132557506 -> 132427302 (-0.10%); split: -0.75%, +0.65%
Spill count: 7144 -> 7234 (+1.26%); split: -0.46%, +1.72%
Fill count: 12086 -> 12403 (+2.62%); split: -0.73%, +3.35%
Scratch Memory Size: 600064 -> 604160 (+0.68%); split: -1.02%, +1.71%
Hitman3:
Totals from 4912 (97.09% of 5059) affected shaders:
Instrs: 2952124 -> 2916824 (-1.20%); split: -1.20%, +0.00%
Cycle count: 179985656 -> 189175250 (+5.11%); split: -2.44%, +7.55%
Spill count: 3739 -> 3136 (-16.13%)
Fill count: 10657 -> 9564 (-10.26%)
Scratch Memory Size: 373760 -> 318464 (-14.79%)
Max live registers: 597566 -> 589460 (-1.36%)
Hogwarts Legacy:
Totals from 1471 (96.33% of 1527) affected shaders:
Instrs: 748749 -> 766214 (+2.33%); split: -0.71%, +3.05%
Cycle count: 33301528 -> 34426308 (+3.38%); split: -1.30%, +4.68%
Spill count: 3278 -> 3070 (-6.35%); split: -8.30%, +1.95%
Fill count: 4553 -> 4097 (-10.02%); split: -10.85%, +0.83%
Scratch Memory Size: 251904 -> 217088 (-13.82%)
Max live registers: 168911 -> 168106 (-0.48%); split: -0.59%, +0.12%
Metro Exodus:
Totals from 18356 (49.81% of 36854) affected shaders:
Instrs: 7559386 -> 7621591 (+0.82%); split: -0.01%, +0.83%
Cycle count: 195240612 -> 196455186 (+0.62%); split: -1.22%, +1.84%
Spill count: 595 -> 546 (-8.24%)
Fill count: 1604 -> 1408 (-12.22%)
Max live registers: 2086937 -> 2086933 (-0.00%)
Red Dead Redemption 2:
Totals from 4171 (79.31% of 5259) affected shaders:
Instrs: 2619392 -> 2719587 (+3.83%); split: -0.00%, +3.83%
Subgroup size: 86416 -> 86432 (+0.02%)
Cycle count: 8542836160 -> 8531976886 (-0.13%); split: -0.65%, +0.53%
Fill count: 12949 -> 12970 (+0.16%); split: -0.43%, +0.59%
Scratch Memory Size: 401408 -> 385024 (-4.08%)
Spiderman Remastered:
Totals from 6639 (98.94% of 6710) affected shaders:
Instrs: 6877980 -> 6800592 (-1.13%); split: -3.11%, +1.98%
Cycle count: 282183352210 -> 282100051824 (-0.03%); split: -0.62%, +0.59%
Spill count: 63147 -> 64218 (+1.70%); split: -7.12%, +8.82%
Fill count: 184931 -> 175591 (-5.05%); split: -10.81%, +5.76%
Scratch Memory Size: 5318656 -> 5970944 (+12.26%); split: -5.91%, +18.17%
Max live registers: 918240 -> 906604 (-1.27%)
Strange Brigade:
Totals from 3675 (92.24% of 3984) affected shaders:
Instrs: 1462231 -> 1429345 (-2.25%); split: -2.25%, +0.00%
Cycle count: 37404050 -> 37345292 (-0.16%); split: -1.25%, +1.09%
Max live registers: 361849 -> 351265 (-2.92%)
Witcher 3:
Totals from 13 (46.43% of 28) affected shaders:
Instrs: 593 -> 660 (+11.30%)
Cycle count: 28302 -> 28714 (+1.46%)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28199>
2024-02-29 20:51:50 +02:00
|
|
|
unsigned ex_mlen,
|
2022-10-14 17:49:00 +03:00
|
|
|
bool ex_bso,
|
2024-11-20 08:12:52 -08:00
|
|
|
bool eot,
|
|
|
|
|
bool gather);
|
2018-11-15 15:17:06 -06:00
|
|
|
|
2021-03-29 15:40:04 -07:00
|
|
|
void gfx6_math(struct brw_codegen *p,
|
2010-08-22 01:33:57 -07:00
|
|
|
struct brw_reg dest,
|
2013-11-25 15:51:24 -08:00
|
|
|
unsigned function,
|
2010-08-22 01:33:57 -07:00
|
|
|
struct brw_reg src0,
|
|
|
|
|
struct brw_reg src1);
|
|
|
|
|
|
2014-06-30 08:00:25 -07:00
|
|
|
/**
|
|
|
|
|
* Return the generation-specific jump distance scaling factor.
|
|
|
|
|
*
|
|
|
|
|
* Given the number of instructions to jump, we need to scale by
|
|
|
|
|
* some number to obtain the actual jump distance to program in an
|
|
|
|
|
* instruction.
|
|
|
|
|
*/
|
|
|
|
|
static inline unsigned
|
2021-04-05 13:19:39 -07:00
|
|
|
brw_jump_scale(const struct intel_device_info *devinfo)
|
2014-06-30 08:00:25 -07:00
|
|
|
{
|
2014-07-03 15:01:58 -07:00
|
|
|
/* Broadwell measures jump targets in bytes. */
|
2024-02-16 14:52:03 -08:00
|
|
|
return 16;
|
2014-06-30 08:00:25 -07:00
|
|
|
}
|
|
|
|
|
|
2014-11-04 18:11:37 -08:00
|
|
|
void brw_barrier(struct brw_codegen *p, struct brw_reg src);
|
|
|
|
|
|
2006-08-09 19:14:05 +00:00
|
|
|
/* If/else/endif. Works by manipulating the execution flags on each
|
|
|
|
|
* channel.
|
|
|
|
|
*/
|
2024-12-14 14:44:47 -08:00
|
|
|
brw_eu_inst *brw_IF(struct brw_codegen *p, unsigned execute_size);
|
2006-08-09 19:14:05 +00:00
|
|
|
|
2015-04-16 11:06:57 -07:00
|
|
|
void brw_ELSE(struct brw_codegen *p);
|
|
|
|
|
void brw_ENDIF(struct brw_codegen *p);
|
2006-08-09 19:14:05 +00:00
|
|
|
|
|
|
|
|
/* DO/WHILE loops:
|
|
|
|
|
*/
|
2024-12-14 14:44:47 -08:00
|
|
|
brw_eu_inst *brw_DO(struct brw_codegen *p, unsigned execute_size);
|
2006-08-09 19:14:05 +00:00
|
|
|
|
2024-12-14 14:44:47 -08:00
|
|
|
brw_eu_inst *brw_WHILE(struct brw_codegen *p);
|
2006-08-09 19:14:05 +00:00
|
|
|
|
2024-12-14 14:44:47 -08:00
|
|
|
brw_eu_inst *brw_BREAK(struct brw_codegen *p);
|
|
|
|
|
brw_eu_inst *brw_CONT(struct brw_codegen *p);
|
|
|
|
|
brw_eu_inst *brw_HALT(struct brw_codegen *p);
|
2006-08-09 19:14:05 +00:00
|
|
|
|
2014-06-05 15:03:07 +02:00
|
|
|
/* Forward jumps:
|
|
|
|
|
*/
|
2024-12-14 14:44:47 -08:00
|
|
|
brw_eu_inst *brw_JMPI(struct brw_codegen *p, struct brw_reg index,
|
2014-06-13 14:29:25 -07:00
|
|
|
unsigned predicate_control);
|
2006-08-09 19:14:05 +00:00
|
|
|
|
2015-04-16 11:06:57 -07:00
|
|
|
void brw_NOP(struct brw_codegen *p);
|
2006-08-09 19:14:05 +00:00
|
|
|
|
2014-11-04 18:05:04 -08:00
|
|
|
void brw_WAIT(struct brw_codegen *p);
|
|
|
|
|
|
2019-09-03 17:51:17 -07:00
|
|
|
void brw_SYNC(struct brw_codegen *p, enum tgl_sync_function func);
|
|
|
|
|
|
2006-08-09 19:14:05 +00:00
|
|
|
/* Special case: there is never a destination, execution size will be
|
|
|
|
|
* taken from src0:
|
|
|
|
|
*/
|
2015-04-16 11:06:57 -07:00
|
|
|
void brw_CMP(struct brw_codegen *p,
|
2006-08-09 19:14:05 +00:00
|
|
|
struct brw_reg dest,
|
2013-11-25 15:51:24 -08:00
|
|
|
unsigned conditional,
|
2006-08-09 19:14:05 +00:00
|
|
|
struct brw_reg src0,
|
|
|
|
|
struct brw_reg src1);
|
|
|
|
|
|
2021-02-13 14:11:30 -08:00
|
|
|
void brw_CMPN(struct brw_codegen *p,
|
|
|
|
|
struct brw_reg dest,
|
|
|
|
|
unsigned conditional,
|
|
|
|
|
struct brw_reg src0,
|
|
|
|
|
struct brw_reg src1);
|
|
|
|
|
|
2024-12-14 14:44:47 -08:00
|
|
|
brw_eu_inst *brw_DPAS(struct brw_codegen *p, enum gfx12_systolic_depth sdepth,
|
2023-09-20 12:42:24 -07:00
|
|
|
unsigned rcount, struct brw_reg dest, struct brw_reg src0,
|
|
|
|
|
struct brw_reg src1, struct brw_reg src2);
|
|
|
|
|
|
2015-02-20 20:14:24 +02:00
|
|
|
void
|
|
|
|
|
brw_broadcast(struct brw_codegen *p,
|
|
|
|
|
struct brw_reg dst,
|
|
|
|
|
struct brw_reg src,
|
|
|
|
|
struct brw_reg idx);
|
|
|
|
|
|
2017-07-01 08:12:59 +02:00
|
|
|
void
|
2019-09-13 01:34:35 +03:00
|
|
|
brw_float_controls_mode(struct brw_codegen *p,
|
|
|
|
|
unsigned mode, unsigned mask);
|
2017-07-01 08:12:59 +02:00
|
|
|
|
2020-08-08 12:55:29 -05:00
|
|
|
void
|
2022-06-29 14:13:31 -07:00
|
|
|
brw_update_reloc_imm(const struct brw_isa_info *isa,
|
2024-12-14 14:44:47 -08:00
|
|
|
brw_eu_inst *inst,
|
2020-08-08 12:55:29 -05:00
|
|
|
uint32_t value);
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
brw_MOV_reloc_imm(struct brw_codegen *p,
|
|
|
|
|
struct brw_reg dst,
|
|
|
|
|
enum brw_reg_type src_type,
|
2023-09-08 00:05:13 +03:00
|
|
|
uint32_t id, uint32_t base);
|
2020-08-08 12:55:29 -05:00
|
|
|
|
2022-12-08 15:39:01 -08:00
|
|
|
unsigned
|
|
|
|
|
brw_num_sources_from_inst(const struct brw_isa_info *isa,
|
2024-12-14 14:44:47 -08:00
|
|
|
const brw_eu_inst *inst);
|
2022-12-08 15:39:01 -08:00
|
|
|
|
2024-12-14 14:44:47 -08:00
|
|
|
void brw_set_src1(struct brw_codegen *p, brw_eu_inst *insn, struct brw_reg reg);
|
2010-03-10 17:16:39 -08:00
|
|
|
|
2024-12-14 14:44:47 -08:00
|
|
|
void brw_set_desc_ex(struct brw_codegen *p, brw_eu_inst *insn,
|
2024-11-20 08:12:52 -08:00
|
|
|
unsigned desc, unsigned ex_desc, bool gather);
|
2018-06-02 13:48:42 -07:00
|
|
|
|
|
|
|
|
static inline void
|
2024-11-20 08:12:52 -08:00
|
|
|
brw_set_desc(struct brw_codegen *p, brw_eu_inst *insn, unsigned desc, bool gather)
|
2018-06-02 13:48:42 -07:00
|
|
|
{
|
2024-11-20 08:12:52 -08:00
|
|
|
brw_set_desc_ex(p, insn, desc, 0, gather);
|
2018-06-02 13:48:42 -07:00
|
|
|
}
|
|
|
|
|
|
2016-08-29 15:57:41 -07:00
|
|
|
void brw_set_uip_jip(struct brw_codegen *p, int start_offset);
|
2010-03-10 17:16:39 -08:00
|
|
|
|
2018-06-07 15:32:15 -07:00
|
|
|
enum brw_conditional_mod brw_negate_cmod(enum brw_conditional_mod cmod);
|
|
|
|
|
enum brw_conditional_mod brw_swap_cmod(enum brw_conditional_mod cmod);
|
2011-04-09 08:22:42 -10:00
|
|
|
|
2012-01-31 16:55:20 -08:00
|
|
|
/* brw_eu_compact.c */
|
2015-04-16 11:06:57 -07:00
|
|
|
void brw_compact_instructions(struct brw_codegen *p, int start_offset,
|
2017-11-15 17:08:42 -08:00
|
|
|
struct disasm_info *disasm);
|
2022-06-29 14:13:31 -07:00
|
|
|
void brw_uncompact_instruction(const struct brw_isa_info *isa,
|
2024-12-14 21:00:44 -08:00
|
|
|
brw_eu_inst *dst, brw_eu_compact_inst *src);
|
2022-06-29 14:13:31 -07:00
|
|
|
bool brw_try_compact_instruction(const struct brw_isa_info *isa,
|
2024-12-14 21:00:44 -08:00
|
|
|
brw_eu_compact_inst *dst, const brw_eu_inst *src);
|
2012-01-31 16:55:20 -08:00
|
|
|
|
2022-06-29 14:13:31 -07:00
|
|
|
void brw_debug_compact_uncompact(const struct brw_isa_info *isa,
|
2024-12-14 14:44:47 -08:00
|
|
|
brw_eu_inst *orig, brw_eu_inst *uncompacted);
|
2012-01-31 16:55:20 -08:00
|
|
|
|
2015-06-29 14:08:51 -07:00
|
|
|
/* brw_eu_validate.c */
|
2022-06-29 14:13:31 -07:00
|
|
|
bool brw_validate_instruction(const struct brw_isa_info *isa,
|
2024-12-14 14:44:47 -08:00
|
|
|
const brw_eu_inst *inst, int offset,
|
2022-07-19 00:27:29 -07:00
|
|
|
unsigned inst_size,
|
2019-11-11 16:11:34 -08:00
|
|
|
struct disasm_info *disasm);
|
2022-06-29 14:13:31 -07:00
|
|
|
bool brw_validate_instructions(const struct brw_isa_info *isa,
|
2017-09-25 13:34:08 +03:00
|
|
|
const void *assembly, int start_offset, int end_offset,
|
2017-11-15 17:08:42 -08:00
|
|
|
struct disasm_info *disasm);
|
2015-06-29 14:08:51 -07:00
|
|
|
|
2014-05-17 13:00:12 -07:00
|
|
|
static inline int
|
2025-01-16 16:31:22 -05:00
|
|
|
next_offset(struct brw_codegen *p, void *store, int offset)
|
2014-05-17 13:00:12 -07:00
|
|
|
{
|
2025-01-16 16:31:22 -05:00
|
|
|
const struct intel_device_info *devinfo = p->devinfo;
|
2025-01-16 16:45:10 -05:00
|
|
|
assert((char *)store + offset < (char *)p->store + p->next_insn_offset);
|
2024-12-14 14:44:47 -08:00
|
|
|
brw_eu_inst *insn = (brw_eu_inst *)((char *)store + offset);
|
2014-05-17 13:00:12 -07:00
|
|
|
|
2024-12-06 12:50:23 -08:00
|
|
|
if (brw_eu_inst_cmpt_control(devinfo, insn))
|
2014-05-17 13:00:12 -07:00
|
|
|
return offset + 8;
|
|
|
|
|
else
|
|
|
|
|
return offset + 16;
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-22 17:58:51 -08:00
|
|
|
/** Maximum SEND message length */
|
|
|
|
|
#define BRW_MAX_MSG_LENGTH 15
|
|
|
|
|
|
2012-04-27 07:40:34 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|