1//===-- ParallelLoopMapperAttr.td - Attribute definition ---*- tablegen -*-===// 2// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6// 7//===----------------------------------------------------------------------===// 8// 9// Defines the attribute used for driving conversion from scf.parallel to 10// gpu.launch operations 11// 12//===----------------------------------------------------------------------===// 13 14#ifndef PARALLEL_LOOP_MAPPER_ATTR 15#define PARALLEL_LOOP_MAPPER_ATTR 16 17include "mlir/Dialect/GPU/GPUBase.td" 18 19def BlockX : I64EnumAttrCase<"BlockX", 0>; 20def BlockY : I64EnumAttrCase<"BlockY", 1>; 21def BlockZ : I64EnumAttrCase<"BlockZ", 2>; 22def ThreadX : I64EnumAttrCase<"ThreadX", 3>; 23def ThreadY : I64EnumAttrCase<"ThreadY", 4>; 24def ThreadZ : I64EnumAttrCase<"ThreadZ", 5>; 25def Sequential : I64EnumAttrCase<"Sequential", 6>; 26 27def ProcessorAttr : I64EnumAttr<"Processor", "processor for loop mapping", [ 28 BlockX, BlockY, BlockZ, ThreadX, ThreadY, ThreadZ, Sequential]> { 29 let cppNamespace = "::mlir::gpu"; 30} 31 32// Attribute that drives conversion of a scf.parallel to gpu.launch 33// operation. 34// processor: the hardware id to map to. 35// map : An affine map that is used to pre-process hardware ids before 36// substitution. 37// bound : An affine map that is used to compute the bound of the hardware 38// id based on an upper bound of the number of iterations. 39def ParallelLoopDimMappingAttr : 40 StructAttr<"ParallelLoopDimMapping", GPU_Dialect, 41 [StructFieldAttr<"processor", ProcessorAttr>, 42 StructFieldAttr<"map", AffineMapAttr>, 43 StructFieldAttr<"bound", AffineMapAttr>]>; 44 45 46def ParallelLoopMappingAttr : 47 TypedArrayAttrBase<ParallelLoopDimMappingAttr, 48 "parallel loop to processor mapping attribute">; 49 50#endif // PARALLEL_LOOP_MAPPER_ATTR 51