Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/kernelbot/cogs/leaderboard_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,14 @@ async def lang_autocomplete(
bot = interaction.client

with bot.leaderboard_db as db:
leaderboard_item = db.get_leaderboard(lb) # type: LeaderboardItem
templates = db.get_leaderboard_templates(lb)

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


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

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

template = add_header_to_template(lang, templates[lang], leaderboard_item)
ext = {"CUDA": "cu", "Python": "py", "Triton": "py", "HIP": "py"}
ext = {"CUDA": "cu", "Python": "py", "Triton": "py", "HIP": "py", "CuteDSL": "py"}
file_name = f"{leaderboard_name}.{ext[lang]}"
file = discord.File(fp=StringIO(template), filename=file_name)
message = f"**Starter code for leaderboard `{leaderboard_name}`**\n"
Expand Down
2 changes: 1 addition & 1 deletion src/libkernelbot/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def make_task_definition(yaml_file: str | Path) -> LeaderboardDefinition: # noq
# load template files
templates = {}
for lang, source in raw.get("templates", {}).items():
assert lang in ["CUDA", "Python", "Triton", "HIP"]
assert lang in ["CUDA", "Python", "Triton", "HIP", "CuteDSL"]
templates[lang] = (root / source).read_text()

if templates:
Expand Down
Loading