Skip to content

Commit

Permalink
Add typos CI, fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Jul 18, 2024
1 parent 6314fb7 commit d50b720
Show file tree
Hide file tree
Showing 39 changed files with 130 additions and 97 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ jobs:
pipx install ruff
ruff check
typos:
name: Typos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: crate-ci/typos@master

pylint:
name: Pylint
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion MEMO
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Documentation Notes
Things to consider
^^^^^^^^^^^^^^^^^^

- Depedencies are pointwise for shared loop dimensions
- Dependencies are pointwise for shared loop dimensions
and global over non-shared ones (between dependent and ancestor)

- multiple insns could fight over which iname gets local axis 0
Expand Down
2 changes: 1 addition & 1 deletion contrib/mem-pattern-explorer/pattern_vis.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def tick(self):
class Array:
def __init__(self, ctx, name, shape, strides, elements_per_row=None):
# Each array element stores a tuple:
# (timestamp, subgroup, g0, g1, g2, ) of last acccess
# (timestamp, subgroup, g0, g1, g2, ) of last access

assert len(shape) == len(strides)

Expand Down
8 changes: 4 additions & 4 deletions doc/misc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ In the meantime, you can generate code simply by saying::
print(cg_result.host_code())
print(cg_result.device_code())

Additionally, for C-based languages, header defintions are available via::
Additionally, for C-based languages, header definitions are available via::

loopy.generate_header(knl)

Expand Down Expand Up @@ -338,8 +338,8 @@ This list is always growing, but here are a few pointers:

Use :func:`loopy.join_inames`.

In what sense does Loopy suport vectorization?
----------------------------------------------
In what sense does Loopy support vectorization?
-----------------------------------------------

There are really two ways in which the OpenCL/CUDA model of computation exposes
vectorization:
Expand All @@ -352,7 +352,7 @@ vectorization:
e.g. ``float4``, which support arithmetic with implicit vector semantics
as well as a number of 'intrinsic' functions.

Loopy suports both. The first one, SIMT, is accessible by tagging inames with,
Loopy supports both. The first one, SIMT, is accessible by tagging inames with,
e.g., ``l.0```. Accessing the second one requires using both execution- and
data-reshaping capabilities in loopy. To start with, you need an array that
has an axis with the length of the desired vector. If that's not yet available,
Expand Down
6 changes: 3 additions & 3 deletions loopy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,18 +563,18 @@ def make_copy_kernel(new_dim_tags, old_dim_tags=None):

indices = ["i%d" % i for i in range(rank)]
shape = ["n%d" % i for i in range(rank)]
commad_indices = ", ".join(indices)
command_indices = ", ".join(indices)
bounds = " and ".join(
f"0<={ind}<{shape_i}"
for ind, shape_i in zip(indices, shape))

set_str = "{{[{}]: {} }}".format(
commad_indices,
command_indices,
bounds
)
result = make_kernel(set_str,
"output[%s] = input[%s]"
% (commad_indices, commad_indices),
% (command_indices, command_indices),
lang_version=MOST_RECENT_LANGUAGE_VERSION,
default_offset=auto)

Expand Down
4 changes: 2 additions & 2 deletions loopy/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,7 @@ def satisfy_dep_reqs_in_order(dep_reqs_to_vars, edges, order):
# for each *pred*, we will calculate all the direct/indirect
# instructions that can be reached.
seen_successors = set()
# first let us start with direct sucessors
# first let us start with direct successors
to_check = edges[pred].copy()
while to_check:
successor = to_check.pop()
Expand Down Expand Up @@ -1219,7 +1219,7 @@ def check_variable_access_ordered(kernel):
"""Checks that between each write to a variable and all other accesses to
the variable there is either:
* a direct/indirect depdendency edge, or
* a direct/indirect dependency edge, or
* an explicit statement that no ordering is necessary (expressed
through a bi-directional :attr:`loopy.InstructionBase.no_sync_with`)
"""
Expand Down
4 changes: 2 additions & 2 deletions loopy/frontend/fortran/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def get_type(self, name, none_ok=False):
return None

raise TranslationError(
"no type for '%s' found in 'implict none' routine"
"no type for '%s' found in 'implicit none' routine"
% name) from None

return self.implicit_types.get(name[0], np.dtype(np.int32))
Expand Down Expand Up @@ -426,7 +426,7 @@ def map_Implicit(self, node):
scope.implicit_types = None

for stmt, specs in node.items:
if scope.implict_types is None:
if scope.implict_types is None: # spellchecker: disable-line
raise TranslationError("implicit decl not allowed after "
"'implicit none'")
tp = self.dtype_from_stmt(stmt)
Expand Down
2 changes: 1 addition & 1 deletion loopy/isl_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def simplify_pw_aff(pw_aff, context=None):
continue

if aff_i.gist(dom_j).is_equal(aff_j):
# aff_i is sufficient to conver aff_j, eliminate aff_j
# aff_i is sufficient to cover aff_j, eliminate aff_j
new_pieces = pieces[:]
if i < j:
new_pieces.pop(j)
Expand Down
4 changes: 2 additions & 2 deletions loopy/kernel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class LoopKernel(Taggable):
.. attribute:: loop_priority
A frozenset of priority constraints to the kernel. Each such constraint
is a tuple of inames. Inames occuring in such a tuple will be scheduled
is a tuple of inames. Inames occurring in such a tuple will be scheduled
earlier than any iname following in the tuple. This applies only to inames
with non-parallel implementation tags.
Expand Down Expand Up @@ -515,7 +515,7 @@ def get_leaf_domain_indices(self, inames):
for iname in inames:
home_domain_index = hdm[iname]
if home_domain_index in domain_indices:
# nothin' new
# nothing new
continue

domain_path_to_root = [home_domain_index] + ppd[home_domain_index]
Expand Down
6 changes: 3 additions & 3 deletions loopy/kernel/creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1884,7 +1884,7 @@ def add_inferred_inames(knl):
# {{{ apply single-writer heuristic

@for_each_kernel
def apply_single_writer_depencency_heuristic(kernel, warn_if_used=True,
def apply_single_writer_dependency_heuristic(kernel, warn_if_used=True,
error_if_used=False):
logger.debug("%s: default deps" % kernel.name)

Expand Down Expand Up @@ -2023,7 +2023,7 @@ class SliceToInameReplacer(IdentityMapper):
.. attribute:: subarray_ref_bounds
A :class:`list` (one entry for each :class:`SubArrayRef` to be created)
of :class:`dict` instances to store the slices enountered in the
of :class:`dict` instances to store the slices encountered in the
expressions as a mapping from ``iname`` to a tuple of ``(start, stop,
step)``, which describes the boxy (i.e. affine) constraints imposed on
the ``iname`` by the corresponding slice notation its intended to
Expand Down Expand Up @@ -2574,7 +2574,7 @@ def make_function(domains, instructions, kernel_data=None, **kwargs):
knl = guess_arg_shape_if_requested(knl, default_order)
knl = apply_default_order_to_args(knl, default_order)
knl = resolve_dependencies(knl)
knl = apply_single_writer_depencency_heuristic(knl, warn_if_used=False)
knl = apply_single_writer_dependency_heuristic(knl, warn_if_used=False)

# -------------------------------------------------------------------------
# Ordering dependency:
Expand Down
2 changes: 1 addition & 1 deletion loopy/kernel/function_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ def is_type_specialized(self):

class CallableKernel(InKernelCallable):
"""
Records informations about a callee kernel. Also provides interface through
Records information about a callee kernel. Also provides interface through
member methods to make the callee kernel compatible to be called from a
caller kernel.
Expand Down
6 changes: 3 additions & 3 deletions loopy/kernel/instruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ class CallInstruction(MultiAssignmentBase):
A tuple of `:class:loopy.Optional`. If an entry is not empty, it
contains the type that will be assigned to the new temporary variable
created from the assigment.
created from the assignment.
.. automethod:: __init__
"""
Expand Down Expand Up @@ -1099,7 +1099,7 @@ def is_array_call(assignees, expression):
Returns *True* is the instruction is an array call.
An array call is a function call applied to array type objects. If any of
the arguemnts or assignees to the function is an array,
the arguments or assignees to the function is an array,
:meth:`is_array_call` will return *True*.
"""
from pymbolic.primitives import Call, Subscript
Expand Down Expand Up @@ -1460,7 +1460,7 @@ class BarrierInstruction(_DataObliviousInstruction):
.. attribute:: mem_kind
A string, ``"global"`` or ``"local"``. Chooses which memory type to
sychronize, for targets that require this (e.g. OpenCL)
synchronize, for targets that require this (e.g. OpenCL)
The textual syntax in a :mod:`loopy` kernel is::
Expand Down
16 changes: 8 additions & 8 deletions loopy/kernel/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def find_all_insn_inames(kernel):
if insn.within_inames_is_final:
continue

# {{{ depdency-based propagation
# {{{ dependency-based propagation

inames_old = insn_id_to_inames[insn.id]
inames_new = inames_old | guess_iname_deps_based_on_var_use(
Expand Down Expand Up @@ -513,8 +513,8 @@ def get_dot_dependency_graph(kernel, callables_table, iname_cluster=True,
"""

# make sure all automatically added stuff shows up
from loopy.kernel.creation import apply_single_writer_depencency_heuristic
kernel = apply_single_writer_depencency_heuristic(kernel, warn_if_used=False)
from loopy.kernel.creation import apply_single_writer_dependency_heuristic
kernel = apply_single_writer_dependency_heuristic(kernel, warn_if_used=False)

if iname_cluster and not kernel.linearization:
try:
Expand Down Expand Up @@ -1252,9 +1252,9 @@ def find_recursive_dependencies(kernel, insn_ids):

for insn_id in queue:
insn = kernel.id_to_insn[insn_id]
additionals = insn.depends_on - result
result.update(additionals)
new_queue.extend(additionals)
additional = insn.depends_on - result
result.update(additional)
new_queue.extend(additional)

queue = new_queue

Expand Down Expand Up @@ -1735,7 +1735,7 @@ def get_global_barrier_order(kernel):

@memoize_on_first_arg
def find_most_recent_global_barrier(kernel, insn_id):
"""Return the id of the latest occuring global barrier which the
"""Return the id of the latest occurring global barrier which the
given instruction (indirectly or directly) depends on, or *None* if this
instruction does not depend on a global barrier.
Expand Down Expand Up @@ -1995,7 +1995,7 @@ def infer_args_are_input_output(kernel):
elif isinstance(arg, (ConstantArg, ImageArg, ValueArg)):
pass
else:
raise NotImplementedError("Unkonwn argument type %s." % type(arg))
raise NotImplementedError("Unknown argument type %s." % type(arg))

if not (arg.is_input or arg.is_output):
raise LoopyError("Kernel argument must be either input or output."
Expand Down
2 changes: 1 addition & 1 deletion loopy/match.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Matching functionality for instruction ids and subsitution
"""Matching functionality for instruction ids and substitution
rule invocations stacks."""


Expand Down
4 changes: 2 additions & 2 deletions loopy/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class Options(ImmutableRecord):
.. attribute:: cl_exec_manage_array_events
Within the PyOpenCL executor, respect and udpate
Within the PyOpenCL executor, respect and update
:attr:`pyopencl.array.Array.events`.
Defaults to *True*.
Expand Down Expand Up @@ -156,7 +156,7 @@ class Options(ImmutableRecord):
Allow re-ordering of floating point arithmetic. Re-ordering may
give different results as floating point arithmetic is not
associative in addition and mulitplication. Default is *True*.
associative in addition and multiplication. Default is *True*.
Note that the implementation of this option is currently incomplete.
.. attribute:: build_options
Expand Down
4 changes: 2 additions & 2 deletions loopy/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -825,8 +825,8 @@ def preprocess_program(t_unit: TranslationUnit) -> TranslationUnit:
from loopy.transform.subst import expand_subst
t_unit = expand_subst(t_unit)

from loopy.kernel.creation import apply_single_writer_depencency_heuristic
t_unit = apply_single_writer_depencency_heuristic(t_unit)
from loopy.kernel.creation import apply_single_writer_dependency_heuristic
t_unit = apply_single_writer_dependency_heuristic(t_unit)

# Ordering restrictions:
#
Expand Down
6 changes: 3 additions & 3 deletions loopy/schedule/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ def get_insns_in_topologically_sorted_order(
for dep in insn.depends_on:
rev_dep_map[dep].add(insn.id)

# For breaking ties, we compare the features of an intruction
# For breaking ties, we compare the features of an instruction
# so that instructions with the same set of features are lumped
# together. This helps in :method:`schedule_as_many_run_insns_as_possible`
# which bails after 5 insns that don't have the same feature.
Expand Down Expand Up @@ -1196,7 +1196,7 @@ def insn_sort_key(insn_id):
print(
"%(warn)swarning:%(reset_all)s '%(iname)s', "
"which the schedule is "
"currently stuck inside of, seems mis-nested. "
"currently stuck inside of, seems misnested. "
"'%(subdep)s' must occur " "before '%(dep)s', "
"but '%(subdep)s must be outside "
"'%(iname)s', whereas '%(dep)s' must be back "
Expand Down Expand Up @@ -1404,7 +1404,7 @@ def insn_sort_key(insn_id):
get_priority_tiers(wanted, sched_state.kernel.loop_priority))

# Update the loop priority set, because some constraints may have
# have been contradictary.
# have been contradictory.
loop_priority_set = set().union(*[set(t) for t in priority_tiers])

priority_tiers.append(
Expand Down
12 changes: 6 additions & 6 deletions loopy/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ class Op(ImmutableRecord):
work-group executes on a single compute unit with all work-items within
the work-group sharing local memory. A sub-group is an
implementation-dependent grouping of work-items within a work-group,
analagous to an NVIDIA CUDA warp.
analogous to an NVIDIA CUDA warp.
.. attribute:: kernel_name
Expand Down Expand Up @@ -723,7 +723,7 @@ class MemAccess(ImmutableRecord):
work-group executes on a single compute unit with all work-items within
the work-group sharing local memory. A sub-group is an
implementation-dependent grouping of work-items within a work-group,
analagous to an NVIDIA CUDA warp.
analogous to an NVIDIA CUDA warp.
.. attribute:: kernel_name
Expand Down Expand Up @@ -1109,7 +1109,7 @@ def _get_lid_and_gid_strides(knl, array, index):

# create lid_strides and gid_strides dicts

# strides are coefficents in flattened index, i.e., we want
# strides are coefficients in flattened index, i.e., we want
# lid_strides = {0:l0, 1:l1, 2:l2, ...} and
# gid_strides = {0:g0, 1:g1, 2:g2, ...},
# where l0, l1, l2, g0, g1, and g2 come from flattened index
Expand Down Expand Up @@ -1723,7 +1723,7 @@ def get_op_map(program, count_redundant_work=False,
:arg subgroup_size: (currently unused) An :class:`int`, :class:`str`
``"guess"``, or *None* that specifies the sub-group size. An OpenCL
sub-group is an implementation-dependent grouping of work-items within
a work-group, analagous to an NVIDIA CUDA warp. subgroup_size is used,
a work-group, analogous to an NVIDIA CUDA warp. subgroup_size is used,
e.g., when counting a :class:`MemAccess` whose count_granularity
specifies that it should only be counted once per sub-group. If set to
*None* an attempt to find the sub-group size using the device will be
Expand Down Expand Up @@ -1921,7 +1921,7 @@ def get_mem_access_map(program, count_redundant_work=False,
:arg subgroup_size: An :class:`int`, :class:`str` ``"guess"``, or
*None* that specifies the sub-group size. An OpenCL sub-group is an
implementation-dependent grouping of work-items within a work-group,
analagous to an NVIDIA CUDA warp. subgroup_size is used, e.g., when
analogous to an NVIDIA CUDA warp. subgroup_size is used, e.g., when
counting a :class:`MemAccess` whose count_granularity specifies that it
should only be counted once per sub-group. If set to *None* an attempt
to find the sub-group size using the device will be made, if this fails
Expand Down Expand Up @@ -2085,7 +2085,7 @@ def get_synchronization_map(program, subgroup_size=None, entrypoint=None):
:arg subgroup_size: (currently unused) An :class:`int`, :class:`str`
``"guess"``, or *None* that specifies the sub-group size. An OpenCL
sub-group is an implementation-dependent grouping of work-items within
a work-group, analagous to an NVIDIA CUDA warp. subgroup_size is used,
a work-group, analogous to an NVIDIA CUDA warp. subgroup_size is used,
e.g., when counting a :class:`MemAccess` whose count_granularity
specifies that it should only be counted once per sub-group. If set to
*None* an attempt to find the sub-group size using the device will be
Expand Down
4 changes: 2 additions & 2 deletions loopy/symbolic.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ class TaggedVariable(LoopyExpressionBase, p.Variable, Taggable):
A :class:`frozenset` of subclasses of :class:`pytools.tag.Tag` used to
provide metadata on this object. Legacy string tags are converted to
:class:`~loopy.LegacyStringInstructionTag` or, if they used to carry
a functional meaning, the tag carrying that same fucntional meaning
a functional meaning, the tag carrying that same functional meaning
(e.g. :class:`~loopy.UseStreamingStoreTag`).
Inherits from :class:`pymbolic.primitives.Variable`
Expand Down Expand Up @@ -737,7 +737,7 @@ class Reduction(LoopyExpressionBase):
.. attribute:: allow_simultaneous
A :class:`bool`. If not *True*, an iname is allowed to be used
in precisely one reduction, to avoid mis-nesting errors.
in precisely one reduction, to avoid misnesting errors.
"""

init_arg_names = ("operation", "inames", "expr", "allow_simultaneous")
Expand Down
Loading

0 comments on commit d50b720

Please sign in to comment.