[llvm-branch-commits] [llvm] [2/7][PISA] Add PISA IR intrinsics, address-space utilities, calling convention (PR #214096)

Michal Paszkowski via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Sep 23 11:48:37 PDT 2026


================
@@ -0,0 +1,262 @@
+//===- IntrinsicsPISA.td - Defines PISA intrinsics ---------*- tablegen -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines all of the PISA-specific intrinsics.
+//
+//===----------------------------------------------------------------------===//
+
+// Pointer type definitions. See the PISA address-space specification:
+// https://intel.github.io/pisa/spaces_types.html#address-spaces
+def pisa_generic_ptr_ty  : LLVMQualPointerType<0>;  // (generic)*
+def pisa_global_ptr_ty   : LLVMQualPointerType<1>;  // (global)*
+def pisa_constant_ptr_ty : LLVMQualPointerType<2>;  // (constant)*
+def pisa_shared_ptr_ty   : LLVMQualPointerType<3>;  // (shared)*
+
+// Base classes.
+class PISAIntrinsic<list<LLVMType> ret_types, list<LLVMType> param_types = [],
+                    list<IntrinsicProperty> intr_properties = [], string name = "">
+    : Intrinsic<ret_types, param_types, intr_properties, name> {
+  let TargetPrefix = "pisa";
+}
+
+class PISADefaultAttrsIntrinsic<list<LLVMType> ret_types, list<LLVMType> param_types = [],
+                                list<IntrinsicProperty> intr_properties = [], string name = "">
+    : DefaultAttrsIntrinsic<ret_types, param_types, intr_properties, name> {
+  let TargetPrefix = "pisa";
+}
+
+class PISAIntrinsicClang<list<LLVMType> RetTypes, list<LLVMType> ParamTypes = [],
+                         list<IntrinsicProperty> IntrProperties = [], string ClangName, string Name = "">
+    : PISAIntrinsic<RetTypes, ParamTypes, IntrProperties, Name>,
+      ClangBuiltin<!strconcat("__builtin_pisa_", ClangName)>;
+
+class PISADefaultAttrsIntrinsicClang<list<LLVMType> RetTypes, list<LLVMType> ParamTypes = [],
+                                     list<IntrinsicProperty> IntrProperties = [],
+                                     string ClangName, string Name = "">
+    : PISADefaultAttrsIntrinsic<RetTypes, ParamTypes, IntrProperties, Name>,
+      ClangBuiltin<!strconcat("__builtin_pisa_", ClangName)>;
+
+// Multiclass for XYZ dimension variants.
+multiclass PISAIntrinsicXYZ<list<LLVMType> RetTypes, list<LLVMType> ParamTypes = [],
+                            list<IntrinsicProperty> IntrProperties = [], string ClangName> {
+  def _x : PISADefaultAttrsIntrinsicClang<RetTypes, ParamTypes, IntrProperties, !strconcat(ClangName, "_x")>;
+  def _y : PISADefaultAttrsIntrinsicClang<RetTypes, ParamTypes, IntrProperties, !strconcat(ClangName, "_y")>;
+  def _z : PISADefaultAttrsIntrinsicClang<RetTypes, ParamTypes, IntrProperties, !strconcat(ClangName, "_z")>;
+}
+
+// Constants.
+defvar MAX_WORK_DIM = 3;
+defvar MAX_LOCAL_SIZE = 65536;
+defvar MAX_SUB_GROUP_SIZE = 32;
+
+// Helper classes for common ArgInfo patterns. See the PISA rounding modes:
+// https://intel.github.io/pisa/floating_point.html#rounding-mode
+class RoundingModeArgInfo<ArgIndex idx> : ArgInfo<idx, [ArgName<"round">, ImmArgPrinter<"printRoundingMode">]>;
+class SaturationArgInfo<ArgIndex idx>   : ArgInfo<idx, [ArgName<"saturation">]>;
+class NanPropagateArgInfo<ArgIndex idx> : ArgInfo<idx, [ArgName<"nanp">]>;
+
+// Helper class for barrier intrinsics.
+class PISAIntrinsicBarrier<string ClangName, list<LLVMType> param_types = []>
+    : PISAIntrinsicClang<[], param_types, [IntrNoMem, IntrHasSideEffects, IntrConvergent], ClangName>;
+
+// Helper class for unary float operations with rounding mode.
+class PISAUnaryRndIntrinsic
+    : PISADefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>, llvm_i8_ty], [IntrNoMem, ImmArg<ArgIndex<1>>]>;
----------------
michalpaszkowski wrote:

Addressed in the 33c0cba Add RoundingModeArgInfo to PISAUnaryRndIntrinsic, PISABinaryRndIntrinsic, int_pisa_fptosi_rnd, int_pisa_fptoui_rnd commit.

https://github.com/llvm/llvm-project/pull/214096


More information about the llvm-branch-commits mailing list