Skip to content

Козлова Екатерина. Лабораторная работа 4: MLIR. Вариант 4. #154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: course-spring-2025
Choose a base branch
from

Conversation

KatyaKozlova
Copy link

Данный MLIR-пасс анализирует функции в модуле и вычисляет глубину вложенности циклов (scf.for, scf.while, affine.for) внутри каждой функции. Для каждого цикла рекурсивно вычисляется глубина вложенных регионов, представляющая уровень вложенности. Затем пасс сохраняет эти глубины циклов в виде атрибута-массива целых чисел под названием "my_loop_depths" на самой операции функции. Для вычисления глубины каждого региона цикла используется рекурсивная функция computeRegionDepth, которая возвращает максимальную глубину

return "ExamplePass_Kozlova_Ekaterina_FIIT3_MLIR";
}

mlir::StringRef getDescription() const override { return "Pass"; }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add more valuable description?

// CHECK-NEXT: }
// CHECK-NEXT: return
// CHECK-NEXT: }
func.func @test5() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a test:

Suggested change
func.func @test5() {
func.func @test5() {
%c0 = arith.constant 0 : index
%c7 = arith.constant 7 : index
%c1 = arith.constant 1 : index
%cond = arith.constant true
scf.if %cond {
scf.for %i = %c0 to %c7 step %c1 {
scf.if %cond {
}
}
}
return
}
```?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants