Closed zzzDavid closed 1 year ago
I've finished rewriting all errors and warnings in build_ir.py
with this new package. The errors and warnings in the front end will be rewritten in the future. This package should act as a central place to handle exceptions.
The revamped frontend uses this exception package for warnings and errors. I will move the descriptions to documentation once the website is up, closing this thread.
Description
This thread is about adding an exception package for HeteroCL. This package provides a systematic way to define and issue warnings and errors. The package hierarchy follows Python's documentation: having an exception base class, with errors and warnings as subclasses. This package inherits all the errors defined in Halide-based HeteroCL here, and adds warning support.
Features
warnings
package, so that warnings can be ignored or filteredClass Hierarchy
Developers can subclass
HCLError
andHCLWarning
to add new types of warning and errors.Usage
Throw an error,
DTypeError
as an exampleIssue a warning,
HCLDeprecationWarning
as an exampleDetect expected error,
APIError
as an exampleDetect expected warnings,
HCLDeprecationWarning
as an exampledef test_deprecate_stage(): with warnings.catch_warnings(record=True) as w: hcl.init(hcl.Int(32)) A = hcl.placeholder((10,))