Skip to content

Commit 6879cc4

Browse files
authored
Add missing outputs to add_halide_library; fix advice in Lesson 21. (#8660)
The extra outputs `conceptual_stmt`, `conceptual_stmt_html`, and `device_code` were missing. Cross-references between cmake/HalideGeneratorHelpers.cmake and src/Module.cpp were added in comments to serve as reminders to implement missing outputs.
1 parent 3061b99 commit 6879cc4

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

cmake/HalideGeneratorHelpers.cmake

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,18 +173,26 @@ function(_Halide_library_from_generator TARGET)
173173
)
174174

175175
## "hash table" of extra outputs to extensions
176+
# Keep in sync with Module.cpp
176177
set(assembly_extension ".s")
177178
set(bitcode_extension ".bc")
179+
# set(c_header_extension ".h") # handled specially
178180
set(c_source_extension ".halide_generated.cpp")
179181
set(compiler_log_extension ".halide_compiler_log")
182+
set(conceptual_stmt_extension ".conceptual.stmt")
183+
set(conceptual_stmt_html_extension ".conceptual.stmt.html")
184+
# set(cpp_stub_extension ".stub.h") # not implemented
185+
set(device_code_extension ".device_code")
180186
set(featurization_extension ".featurization")
181187
set(function_info_header_extension ".function_info.h")
182188
set(hlpipe_extension ".hlpipe")
183189
set(llvm_assembly_extension ".ll")
190+
# set(object_extension (is_windows_coff ? ".obj" : ".o")) # handled specially
184191
set(python_extension_extension ".py.cpp")
185192
set(pytorch_wrapper_extension ".pytorch.h")
186193
set(registration_extension ".registration.cpp")
187194
set(schedule_extension ".schedule.h")
195+
# set(static_library_extension (is_windows_coff ? ".lib" : ".a")) # handled specially
188196
set(stmt_extension ".stmt")
189197
set(stmt_html_extension ".stmt.html")
190198

@@ -440,15 +448,17 @@ function(add_halide_library TARGET)
440448

441449
# See Module.cpp for list of extra outputs. The following outputs intentionally do not appear:
442450
# - `c_header` is always generated
443-
# - `c_source` is selected by C_BACKEND
451+
# - `cpp_stub` is not available
444452
# - `object` is selected for CMake-target-compile
445453
# - `static_library` is selected for cross-compile
446-
# - `cpp_stub` is not available
447454
set(extra_output_names
448455
ASSEMBLY
449456
BITCODE
450457
COMPILER_LOG
458+
CONCEPTUAL_STMT
459+
CONCEPTUAL_STMT_HTML
451460
C_SOURCE
461+
DEVICE_CODE
452462
FEATURIZATION
453463
FUNCTION_INFO_HEADER
454464
HLPIPE
@@ -458,7 +468,8 @@ function(add_halide_library TARGET)
458468
REGISTRATION
459469
SCHEDULE
460470
STMT
461-
STMT_HTML)
471+
STMT_HTML
472+
)
462473

463474
##
464475
# Parse the arguments and set defaults for missing values.

src/Module.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ std::map<OutputFileType, const OutputInfo> get_output_info(const Target &target)
3131
constexpr bool IsMulti = true;
3232
constexpr bool IsSingle = false;
3333
const bool is_windows_coff = target.os == Target::Windows;
34+
// Keep in sync with cmake/HalideGeneratorHelpers.cmake
3435
std::map<OutputFileType, const OutputInfo> ext = {
3536
{OutputFileType::assembly, {"assembly", ".s", IsMulti}},
3637
{OutputFileType::bitcode, {"bitcode", ".bc", IsMulti}},

tutorial/lesson_21_auto_scheduler_generate.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,9 @@ class AutoScheduled : public Halide::Generator<AutoScheduled> {
126126

127127
// If HL_DEBUG_CODEGEN is set to 3 or greater, the schedule will be dumped
128128
// to stdout (along with much other information); a more useful way is
129-
// to add "schedule" to the -e flag to the Generator. (In CMake and Bazel,
130-
// this is done using the "extra_outputs" flag.)
129+
// to add "schedule" to the -e flag to the Generator. In CMake, this is
130+
// done by passing the argument SCHEDULE <outvar> to add_halide_library().
131+
// See doc/HalideCMakePackage.md for more detail.
131132

132133
// The generated schedule that is dumped to file is an actual
133134
// Halide C++ source, which is readily copy-pasteable back into

0 commit comments

Comments
 (0)