• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

daisytuner / docc / 24102763944

07 Apr 2026 08:26PM UTC coverage: 64.814% (+0.02%) from 64.797%
24102763944

push

github

web-flow
Separate can_be_applied and apply for GPUTilling during Loop Scheduling (#632)

* restructure stride minimization pass

* remove iterative bottleneck and add/fix tests

* loop distribute rework

* Loop distributionfix and unit tests

* Refactor loop scheduler to split the can be applied from the apply to save quadratic analysis recalculation cost.

* enforce can be applied for polly scheduler

* add branching

* guard rpc scheduler

* remove redundant analysis

* remove multi invalidation

* add resnet subset tests

* remove redundant invalidates

* light weight invalidation of scope analysis

* revert stride minimization and perfect loop distribution to main

* update tenstorrent scheduler

* Drop submodels from PR

* extend candidate selection to skip impossible candidates fast

* Stream line kls criterions to reuse them for the scheduler.
Saperating can be applied and apply calls

* remove polly header

* Use new RTX label

53 of 67 new or added lines in 2 files covered. (79.1%)

23 existing lines in 4 files now uncovered.

28868 of 44540 relevant lines covered (64.81%)

605.56 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

48.94
/opt/src/passes/offloading/gpu_tiling_pass.cpp
1
#include "sdfg/passes/offloading/gpu_tiling_pass.h"
2

3
#include "sdfg/analysis/loop_analysis.h"
4
#include "sdfg/analysis/users.h"
5
#include "sdfg/structured_control_flow/structured_loop.h"
6
#include "sdfg/targets/cuda/cuda.h"
7
#include "sdfg/targets/rocm/rocm.h"
8
#include "sdfg/transformations/loop_tiling.h"
9
#include "sdfg/transformations/offloading/gpu_tiling.h"
10
#include "sdfg/transformations/offloading/kernel_local_storage.h"
11

12
namespace sdfg {
13
namespace passes {
14

15
GPUTilingPass::GPUTilingPass(const std::vector<structured_control_flow::Map*>& maps, size_t tile_size)
16
    : maps_(maps), tile_size_(tile_size) {}
3✔
17

18
bool GPUTilingPass::run_pass(builder::StructuredSDFGBuilder& builder, analysis::AnalysisManager& analysis_manager) {
3✔
19
    if (maps_.empty()) {
3✔
20
        return false;
×
21
    }
×
22

23
    auto& loop_analysis = analysis_manager.get<analysis::LoopAnalysis>();
3✔
24

25
    // Phase 1: Collect all applicable tiling targets
26
    std::vector<structured_control_flow::StructuredLoop*> candidates;
3✔
27
    auto& users = analysis_manager.get<analysis::Users>();
3✔
28

29
    // Find targets for normal loop tiling
30
    for (auto* map : maps_) {
4✔
31
        for (auto* descendant : loop_analysis.descendants(map)) {
4✔
32
            auto* struc_loop = dynamic_cast<structured_control_flow::StructuredLoop*>(descendant);
2✔
33
            if (!struc_loop) continue;
2✔
34

35

36
            // Pre-filter: check if any container used in the loop is a KLS candidate
37
            analysis::UsersView users_view(users, struc_loop->root());
2✔
38
            bool has_kls_candidate = false;
2✔
39
            for (const auto& container : users_view.all_containers_in_order()) {
6✔
40
                if (transformations::KernelLocalStorage::is_candidate(*struc_loop, container, builder, analysis_manager)) {
6✔
NEW
41
                    has_kls_candidate = true;
×
NEW
42
                    break;
×
NEW
43
                }
×
44
            }
6✔
45
            if (!has_kls_candidate) continue;
2✔
46

NEW
47
            transformations::LoopTiling tiling(*struc_loop, tile_size_);
×
NEW
48
            if (tiling.can_be_applied(builder, analysis_manager)) {
×
NEW
49
                candidates.push_back(struc_loop);
×
NEW
50
            }
×
NEW
51
        }
×
52
    }
4✔
53

54
    std::vector<structured_control_flow::StructuredLoop*> tilable_loops;
3✔
55

56
    for (auto* map : candidates) {
3✔
UNCOV
57
        for (auto* descendant : loop_analysis.descendants(map)) {
×
UNCOV
58
            if (auto* target_loop = dynamic_cast<structured_control_flow::StructuredLoop*>(descendant)) {
×
UNCOV
59
                transformations::GPUTiling tiling(*target_loop, tile_size_);
×
UNCOV
60
                if (tiling.can_be_applied(builder, analysis_manager)) {
×
NEW
61
                    tilable_loops.push_back(target_loop);
×
62
                }
×
UNCOV
63
            }
×
UNCOV
64
        }
×
UNCOV
65
    }
×
66

67
    if (tilable_loops.empty()) {
3✔
68
        return false;
3✔
69
    }
3✔
70

71
    // Phase 2: Apply all tilings
NEW
72
    for (auto* target_loop : tilable_loops) {
×
73
        transformations::GPUTiling tiling(*target_loop, tile_size_);
×
74
        tiling.apply(builder, analysis_manager);
×
75
    }
×
76

77
    return true;
×
78
}
3✔
79

80
} // namespace passes
81
} // namespace sdfg
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc