Repository navigation
Implementation of Remaining Metal Backend - #36
Merged
Merged
Conversation
* one extra backtracking step, * backtracking in the wrong direction, * diffuse term twice as large
…backtracked collision point
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Metal implementations of the 2D similarity metrics and of the surface rendering and occluding contour ray casters. With these, a registration can run on a Mac GPU with Metal for both ray casting and similarity scoring. Metal becomes the default backend when a Metal device is available.
New Metal implementations
2D similarity metrics (
lib/regi/sim_metrics_2d/)ImgSimMetric2D*Metal), with a shared base classImgSimMetric2DMetal.--backend metalworks for all five*SimMetricFromProgOpts()factories.Ray casters (
lib/ray_cast/)RayCasterSurRenderMetal: Phong-shaded surface rendering.RayCasterOccludingContoursMetal: occluding contours.Shared Metal infrastructure
MetalComputeEncoder(xregMetalCompute.h): a plain C++ wrapper for encoding several dependent kernel dispatches and waiting once, so metric and caster classes don't need Objective-C++.ThreadgroupReducer(xregMetalReduce.metal): sums across a threadgroup using SIMD-group reductions.BacktrackToSurfaceandCentralDiffGradientinxregRayCastBaseMetal.metal. The existing depth kernel now usesBacktrackToSurface; its results are unchanged.Bug fixes in existing code
ImgSimMetric2DSSDOCL: kernel arguments were set before the fixed-image and mask buffers existed. With a host fixed image this crashed; otherwise the image length argument was 0, so the result was each moving image's mean intensity instead of the SSD.RayCasterSurRenderOCL:RayCasterSurRenderCPU:std::tie(min, min));Pt2divided every shaded value by the camera focal length.RayCasterOccludingContoursCPU: when continuing past a collision with backtracking, the ray resumed from the backtracked position and stopped advancing inside objects. It now resumes from the sample.Behaviour changes
--backend ocland--backend cpustill work.--ocl-id: now accepts any case-insensitive substring that matches exactly one OpenCL device ID, the same as--metal-id. No match, or more than one, is an error that lists the IDs. An exact full ID still takes precedence. The matching logic is shared viaFindMapEntriesByKeySubstrIgnoreCase(xregStringUtils.h).tests/wiki_cmds.py: new--backendand--deviceoptions.