From 4a80d946dbd07d01033425f9a9b82d9f31f34a37 Mon Sep 17 00:00:00 2001 From: Steven Robertson Date: Wed, 1 Sep 2010 23:34:24 -0400 Subject: [PATCH] Add `comment` to DSL --- cuburnlib/ptx.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cuburnlib/ptx.py b/cuburnlib/ptx.py index 437446c..1b7443e 100644 --- a/cuburnlib/ptx.py +++ b/cuburnlib/ptx.py @@ -453,6 +453,13 @@ class _LabelFactory(object): self.block.inject(name, Label(name)) self.block.code(prefix='%s:' % name, semi=False) +class Comment(object): + """Add a single-line comment to the PTX output.""" + def __init__(self, block): + self.block = block + def __call__(self, comment): + self.block.code(op=['// ', comment], semi=False) + class PTXFragment(object): """ An object containing PTX DSL functions. @@ -627,6 +634,7 @@ class _PTXStdLib(PTXFragment): addr=Mem.addr, vec=Mem.vec, label=_LabelFactory(self.block), + comment=Comment(self.block), get_gtid=self._get_gtid) class PTXModule(object):