Skip to content

Commit 730feef

Browse files
authored
Feat: add cutedsl to templates (#371)
1 parent 90e2be3 commit 730feef

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/kernelbot/cogs/leaderboard_cog.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,14 @@ async def lang_autocomplete(
223223
bot = interaction.client
224224

225225
with bot.leaderboard_db as db:
226-
leaderboard_item = db.get_leaderboard(lb) # type: LeaderboardItem
226+
templates = db.get_leaderboard_templates(lb)
227227

228-
candidates = leaderboard_item["task"].templates
228+
candidates = list(templates.keys())
229229
return [discord.app_commands.Choice(name=c, value=c) for c in candidates]
230230

231231

232232
def add_header_to_template(lang: str, code: str, lb: LeaderboardItem):
233-
comment_char = {"CUDA": "//", "Python": "#", "Triton": "#", "HIP": "#"}[lang]
233+
comment_char = {"CUDA": "//", "Python": "#", "Triton": "#", "HIP": "#", "CuteDSL": "#"}[lang]
234234

235235
description_comment = [f"{comment_char} > {line}" for line in lb["description"].splitlines()]
236236
header = f"""
@@ -539,7 +539,7 @@ async def get_task_template(
539539
return
540540

541541
template = add_header_to_template(lang, templates[lang], leaderboard_item)
542-
ext = {"CUDA": "cu", "Python": "py", "Triton": "py", "HIP": "py"}
542+
ext = {"CUDA": "cu", "Python": "py", "Triton": "py", "HIP": "py", "CuteDSL": "py"}
543543
file_name = f"{leaderboard_name}.{ext[lang]}"
544544
file = discord.File(fp=StringIO(template), filename=file_name)
545545
message = f"**Starter code for leaderboard `{leaderboard_name}`**\n"

src/libkernelbot/task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def make_task_definition(yaml_file: str | Path) -> LeaderboardDefinition: # noq
144144
# load template files
145145
templates = {}
146146
for lang, source in raw.get("templates", {}).items():
147-
assert lang in ["CUDA", "Python", "Triton", "HIP"]
147+
assert lang in ["CUDA", "Python", "Triton", "HIP", "CuteDSL"]
148148
templates[lang] = (root / source).read_text()
149149

150150
if templates:

0 commit comments

Comments
 (0)